Skip to content

Latest commit

History

History
37 lines (28 loc) 路 1.25 KB

deepEqual.md

File metadata and controls

37 lines (28 loc) 路 1.25 KB
layout title description categories redirect_from
default
deepEqual
A deep recursive comparison, working on primitive types, arrays, objects, regular expressions, dates and functions.
assert
/deepEqual
/deepEqual/

deepEqual( actual, expected [, message ] )

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

name description
actual Expression being tested
expected Known comparison value
message (string) A short description of the assertion

Description

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.

Examples

Compare the value of two objects.

QUnit.test( "deepEqual test", function( assert ) {
  var obj = { foo: "bar" };

  assert.deepEqual( obj, { foo: "bar" }, "Two objects can be the same in value" );
});