-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMap.equals.test.ts
67 lines (55 loc) · 1002 Bytes
/
Map.equals.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import './index.js'
import { equals } from './symbol.js'
describe('Map.prototype[equals]', () => {
it('should compare two maps', () => {
const a = new Map([
['a', 1],
['b', 2],
['c', 3],
])
const b = new Map([
['a', 1],
['b', 2],
['c', 3],
])
expect(a[equals](b)).toBe(true)
})
it('should compare two maps with different sizes', () => {
const a = new Map([
['a', 1],
['b', 2],
['c', 3],
])
const b = new Map([
['a', 1],
['b', 2],
])
expect(a[equals](b)).toBe(false)
})
it('should compare two maps with different values', () => {
const a = new Map([
['a', 1],
['b', 2],
['c', 3],
])
const b = new Map([
['a', 1],
['b', 2],
['c', 4],
])
expect(a[equals](b)).toBe(false)
})
it('should compare two maps with different keys', () => {
const a = new Map([
['a', 1],
['b', 2],
['c', 3],
])
const b = new Map([
['a', 1],
['b', 2],
['d', 3],
])
expect(a[equals](b)).toBe(false)
})
})