Sorry if this is obvious, but is there a notOK or equivalent function in QUnit, if we want to assert that a method returns false?
I can't see a way to negate OK in the documentation.
I tried:
!ok...
but that didn't work.
Sorry if this is obvious, but is there a notOK or equivalent function in QUnit, if we want to assert that a method returns false?
I can't see a way to negate OK in the documentation.
I tried:
!ok...
but that didn't work.
starting from qunit 1.18 there is a dedicated function:
The better approach would be to use:
as it will be more expressive than stating:
If this is something you really, really want, you can add it with
QUnit.extend()
:According to the documentation :
You can verify that a method return a false value by writing an expression which evaluates to a
true
value in the case the method returnsfalse
, and vice versa. The easiest expression to do this is the NOT operator, which in JavaScript is expressed through!
You could use:
ok(!method_expected_to_be_false)