deepEqual()


deepEqual( actual, expected [, message ] )

Description: A deep recursive comparison, working on primitive types, arrays, objects, regular expressions, dates and functions.

The deepEqual() assertion can be used just like equal() when comparing the value of objects, such that { key: value } is equal to { key: value }. For non-scalar values, identity will be disregarded by deepEqual.

notDeepEqual() can be used to explicitly test deep, strict inequality.

Example:

Compare the value of two objects.

1
2
3
4
5
QUnit.test( "deepEqual test", function( assert ) {
var obj = { foo: "bar" };
assert.deepEqual( obj, { foo: "bar" }, "Two objects can be the same in value" );
});