From 5c1a6934329d47e2172de750cbf25277c06791b5 Mon Sep 17 00:00:00 2001 From: Cristian Barlutiu Date: Mon, 17 Jun 2024 08:15:34 +0200 Subject: [PATCH] fixed tests --- test/parallel/test-assert-objects.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-assert-objects.js b/test/parallel/test-assert-objects.js index 96943cc9da0f2f..8bf1835e188ea9 100644 --- a/test/parallel/test-assert-objects.js +++ b/test/parallel/test-assert-objects.js @@ -282,7 +282,7 @@ describe('Object Comparison Tests', function() { }); it('should strictly compare two Map objects from different realms with identical entries', function() { - const map1 = new vm.runInNewContext('Map')([['key1', 'value1'], ['key2', 'value2']]); + const map1 = new vm.runInNewContext('new Map([["key1", "value1"], ["key2", "value2"]])'); const map2 = new Map([ ['key1', 'value1'], ['key2', 'value2'], @@ -291,7 +291,7 @@ describe('Object Comparison Tests', function() { }); it('should not strictly compare two Set objects from different realms with different values', function() { - const set1 = new vm.runInNewContext('Set')(['value1', 'value2']); + const set1 = new vm.runInNewContext('new Set(["value1", "value2"])'); const set2 = new Set(['value1', 'value3']); assert.throws(() => assert.matchObjectStrict(set1, set2), Error); }); @@ -303,10 +303,18 @@ describe('Object Comparison Tests', function() { }); it('should compare plain objects from different realms', function() { - assert.matchObjectStrict( - vm.runInNewContext('({ a: 1, b: 2n, c: "3", d: /4/, e: new Set([5]), f: [6], g: new Uint8Array })'), - { b: 2n, e: new Set([5]), f: [6], g: new Uint8Array() } - ); + const obj1 = vm.runInNewContext(`({ + a: 1, + b: 2n, + c: "3", + d: /4/, + e: new Set([5]), + f: [6], + g: new Uint8Array() + })`); + const obj2 = { b: 2n, e: new Set([5]), f: [6], g: new Uint8Array() }; + + assert.throws(() => assert.matchObjectStrict(obj1, obj2), Error); }); it('should strictly compare two objects with identical getter/setter properties', function() {