unit-testingnode.jsnodeunit

Is there an equivalent to assertFalse in nodeunit?


Using nodeunit is there an assert to check for false values? Other testing frameworks have something like assertFalse, should I use something like:

test.ok(!shouldBeFalse());

or

test.equals(shouldBeFalse(), false);

Or is there a project that adds a false assertion?


Solution

  • If you want to be sure only boolean false is matched than use strictEqual:

    test.strictEqual(shouldBeFalse(), false)
    

    Otherwise equal is ok too.