layout | title | description | categories | redirect_from | |||
---|---|---|---|---|---|---|---|
default |
notEqual |
A non-strict comparison, checking for inequality. |
|
|
A non-strict comparison, checking for inequality.
name | description |
---|---|
actual |
Expression being tested |
expected |
Known comparison value |
message (string) |
A short description of the assertion |
The notEqual
assertion uses the simple inverted comparison operator (!=
) to compare the actual and expected arguments. When they aren't equal, the assertion passes; otherwise, it fails. When it fails, both actual and expected values are displayed in the test result, in addition to a given message.
equal()
can be used to test equality.
notStrictEqual()
can be used to test strict inequality.
The simplest assertion example:
QUnit.test( "a test", function( assert ) {
assert.notEqual( 1, "2", "String '2' and number 1 don't have the same value" );
});