Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
synapse committed Jun 17, 2024
1 parent dacddc4 commit 5c1a693
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/parallel/test-assert-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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);
});
Expand All @@ -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() {
Expand Down

0 comments on commit 5c1a693

Please sign in to comment.