assert: make Maps be partially compared in partialDeepStrictEqual · nodejs/node@e902477

@@ -159,12 +159,26 @@ describe('Object Comparison Tests', () => {

159159

},

160160

{

161161

description:

162-

'throws when comparing two Map objects with different length',

162+

'throws when the expected Map has more entries than the actual Map',

163163

actual: new Map([

164164

['key1', 'value1'],

165165

['key2', 'value2'],

166166

]),

167-

expected: new Map([['key1', 'value1']]),

167+

expected: new Map([

168+

['key1', 'value1'],

169+

['key2', 'value2'],

170+

['key3', 'value3'],

171+

]),

172+

},

173+

{

174+

description: 'throws when the nested array in the Map is not a subset of the other nested array',

175+

actual: new Map([

176+

['key1', ['value1', 'value2']],

177+

['key2', 'value2'],

178+

]),

179+

expected: new Map([

180+

['key1', ['value3']],

181+

]),

168182

},

169183

{

170184

description:

@@ -554,6 +568,63 @@ describe('Object Comparison Tests', () => {

554568

['key2', 'value2'],

555569

]),

556570

},

571+

{

572+

description:

573+

'compares two Map objects where expected is a subset of actual',

574+

actual: new Map([

575+

['key1', 'value1'],

576+

['key2', 'value2'],

577+

]),

578+

expected: new Map([['key1', 'value1']]),

579+

},

580+

{

581+

description:

582+

'compares two deeply nested Maps',

583+

actual: {

584+

a: {

585+

b: {

586+

c: new Map([

587+

['key1', 'value1'],

588+

['key2', 'value2'],

589+

])

590+

},

591+

z: [1, 2, 3]

592+

}

593+

},

594+

expected: {

595+

a: {

596+

z: [1, 2, 3],

597+

b: {

598+

c: new Map([['key1', 'value1']])

599+

}

600+

}

601+

},

602+

},

603+

{

604+

description: 'compares Maps nested into Maps',

605+

actual: new Map([

606+

['key1', new Map([

607+

['nestedKey1', 'nestedValue1'],

608+

['nestedKey2', 'nestedValue2'],

609+

])],

610+

['key2', 'value2'],

611+

]),

612+

expected: new Map([

613+

['key1', new Map([

614+

['nestedKey1', 'nestedValue1'],

615+

])],

616+

])

617+

},

618+

{

619+

description: 'compares Maps with nested arrays inside',

620+

actual: new Map([

621+

['key1', ['value1', 'value2']],

622+

['key2', 'value2'],

623+

]),

624+

expected: new Map([

625+

['key1', ['value1', 'value2']],

626+

]),

627+

},

557628

{

558629

description:

559630

'compares two objects with identical getter/setter properties',