|
| 1 | +import mapCompare from '../../../map/compare.js'; |
| 2 | + |
| 3 | +describe('map/compare', () => { |
| 4 | + |
| 5 | + [ |
| 6 | + [ |
| 7 | + [], |
| 8 | + [], |
| 9 | + ], |
| 10 | + [ |
| 11 | + [['a', '1'], ['b', null], [1, 2]], |
| 12 | + [['a', '1'], ['b', null], [1, 2]], |
| 13 | + ], |
| 14 | + ].forEach(([a, b]) => { |
| 15 | + it(`should compare two maps with values: ${JSON.stringify(a)}`, () => { |
| 16 | + const map1 = new Map(a); |
| 17 | + const map2 = new Map(b); |
| 18 | + const result = mapCompare(map1, map2); |
| 19 | + expect(result).to.eql(true); |
| 20 | + }); |
| 21 | + }); |
| 22 | + |
| 23 | + [ |
| 24 | + [ |
| 25 | + [[1, '1']], |
| 26 | + [], |
| 27 | + ], |
| 28 | + [ |
| 29 | + [['a', '1'], ['b', null], [1, 2]], |
| 30 | + [['a', '1'], ['b', false], [1, 2]], |
| 31 | + ], |
| 32 | + ].forEach(([a, b]) => { |
| 33 | + it(`should reject two maps with differing values: ${JSON.stringify(a)}`, () => { |
| 34 | + const map1 = new Map(a); |
| 35 | + const map2 = new Map(b); |
| 36 | + const result = mapCompare(map1, map2); |
| 37 | + expect(result).to.eql(false); |
| 38 | + }); |
| 39 | + }); |
| 40 | + |
| 41 | +}); |
0 commit comments