Documentation

QUnit/notDeepEqual

From jQuery JavaScript Library

Jump to: navigation, search

« Back to QUnit

notDeepEqual( actual, expected, [message] )

A deep recursive comparison assertion, working on primitive types, arrays and objects, with the result inverted, passing when some property isn't equal.
Similar to deepEqual, inverting the result.
Arguments:

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

Examples:
An example assertion showing how notDeepEqual can be used. notEqual would have the same result here, but notDeepEqual is more reliable when you have no idea what you are actually comparing.

test("a test", function() {
  var actual = {a: 1};
  notDeepEqual(actual, {a: "1"}, "must fail, expected value is a string, actual a number");
});

NameType