From f65854486264a626b71000e8159e121a96f787e6 Mon Sep 17 00:00:00 2001 From: Chris Santero Date: Fri, 18 May 2018 11:54:26 -0400 Subject: [PATCH] [qunit] Add QUnit.equiv --- types/qunit/index.d.ts | 8 ++++++++ types/qunit/qunit-tests.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/types/qunit/index.d.ts b/types/qunit/index.d.ts index a0276a3488..2b7eb586ff 100644 --- a/types/qunit/index.d.ts +++ b/types/qunit/index.d.ts @@ -595,6 +595,14 @@ interface QUnit { */ todo(name: string, callback?: (assert: Assert) => void): void; + /** + * Compares two values. Returns true if they are equivalent. + * + * @param a The first value + * @param b The second value + */ + equiv(a: T, b: T): boolean; + /** * Are the test running from the server or not. */ diff --git a/types/qunit/qunit-tests.ts b/types/qunit/qunit-tests.ts index 25ffc9fbf1..e726113604 100644 --- a/types/qunit/qunit-tests.ts +++ b/types/qunit/qunit-tests.ts @@ -556,3 +556,9 @@ QUnit.test( "test with beforeEach and afterEach", function( assert ) { QUnit.todo( "a todo test", function( assert ) { assert.equal( 0, 1, "0 does not equal 1, so this todo should pass" ); }); + +let equivResult: boolean; +equivResult = QUnit.equiv({}, {}); +equivResult = QUnit.equiv(1, 2); +equivResult = QUnit.equiv('foo', 'bar'); +equivResult = QUnit.equiv(['foo'], ['bar']);