Documentation

QUnit/notStrictEqual

From jQuery JavaScript Library

Jump to: navigation, search

« Back to QUnit

notStrictEqual( actual, expected, [message] )

A stricter comparison assertion then notEqual.
Similar to notEqual(), but passes only when arguments have the same type. Passes if actual !== expected.
Arguments:

actualObject
The actual result
expectedObject
The expected result
message (Optional)String
A message to display with the assertion result

Examples:
Two example assertions showing the difference between notEqual and notStrictEqual.

test("a test", function() {
  var actual = 0;
  notEqual(actual, false, "Fails, as 0 and false both default to false, so end up being equal");
  notStrictEqual(actual, false, "Passes, as 0 is Number and false is Boolean, therefore not strictly equal");
});

NameType