Ad
  • Custom User Avatar

    From the docs

    .not
    Negates all assertions that follow in the chain.
    
    expect(function () {}).to.not.throw();
    expect({a: 1}).to.not.have.property('b');
    expect([1, 2]).to.be.an('array').that.does.not.include(3);
    Just because you can negate any assertion with .not doesn’t mean you should. With great power comes great responsibility. It’s often best to assert that the one expected output was produced, rather than asserting that one of countless unexpected outputs wasn’t produced. See individual assertions for specific guidance.
    
    expect(2).to.equal(2); // Recommended
    expect(2).to.not.equal(1); // Not recommended
    

    Let's say that it should only work out up to 1 billion. I think the test you want to write needs to be more concrete, or I could just return 1 if I can't produce the correct number to pass the test.