From 3ca66e4c4ecfa50210efe3488c4dd59ce5ad126b Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 20 Sep 2021 04:57:10 +0100 Subject: [PATCH] Tests: Add coverage for basic "getter" behaviour in status quo Ref https://github.com/qunitjs/qunit/issues/1325. --- test/main/deepEqual.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/main/deepEqual.js b/test/main/deepEqual.js index 60a6e602d..357d1ea96 100644 --- a/test/main/deepEqual.js +++ b/test/main/deepEqual.js @@ -1753,6 +1753,23 @@ QUnit.test( "Boolean objects", function( assert ) { ); } ); +QUnit.test( "Getter", function( assert ) { + var a = { + get x() { return 2; } + }; + var a2 = { + get x() { return 2; } + }; + var b = { + get x() { return 4; } + }; + assert.false( QUnit.equiv( a, b ), "Getters with different values are not equivalent" ); + assert.true( QUnit.equiv( a, a2 ), "Same value from different getters are equivalent" ); + + // Neither the presence of a descriptor nor the descriptor itself is compared + assert.true( QUnit.equiv( b, { x: 4 } ), "Getter and literal value are equivalent" ); +} ); + var hasES6Set = ( function() { if ( typeof Set !== "function" ) { return false;