Skip to content

Commit 5c1a693

Browse files
committed
fixed tests
1 parent dacddc4 commit 5c1a693

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/parallel/test-assert-objects.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ describe('Object Comparison Tests', function() {
282282
});
283283

284284
it('should strictly compare two Map objects from different realms with identical entries', function() {
285-
const map1 = new vm.runInNewContext('Map')([['key1', 'value1'], ['key2', 'value2']]);
285+
const map1 = new vm.runInNewContext('new Map([["key1", "value1"], ["key2", "value2"]])');
286286
const map2 = new Map([
287287
['key1', 'value1'],
288288
['key2', 'value2'],
@@ -291,7 +291,7 @@ describe('Object Comparison Tests', function() {
291291
});
292292

293293
it('should not strictly compare two Set objects from different realms with different values', function() {
294-
const set1 = new vm.runInNewContext('Set')(['value1', 'value2']);
294+
const set1 = new vm.runInNewContext('new Set(["value1", "value2"])');
295295
const set2 = new Set(['value1', 'value3']);
296296
assert.throws(() => assert.matchObjectStrict(set1, set2), Error);
297297
});
@@ -303,10 +303,18 @@ describe('Object Comparison Tests', function() {
303303
});
304304

305305
it('should compare plain objects from different realms', function() {
306-
assert.matchObjectStrict(
307-
vm.runInNewContext('({ a: 1, b: 2n, c: "3", d: /4/, e: new Set([5]), f: [6], g: new Uint8Array })'),
308-
{ b: 2n, e: new Set([5]), f: [6], g: new Uint8Array() }
309-
);
306+
const obj1 = vm.runInNewContext(`({
307+
a: 1,
308+
b: 2n,
309+
c: "3",
310+
d: /4/,
311+
e: new Set([5]),
312+
f: [6],
313+
g: new Uint8Array()
314+
})`);
315+
const obj2 = { b: 2n, e: new Set([5]), f: [6], g: new Uint8Array() };
316+
317+
assert.throws(() => assert.matchObjectStrict(obj1, obj2), Error);
310318
});
311319

312320
it('should strictly compare two objects with identical getter/setter properties', function() {

0 commit comments

Comments
 (0)