Skip to content

Commit d9fec14

Browse files
dennybiasiollitimdorr
authored andcommitted
tests: improving shallowEqual tests covering more options (reduxjs#905)
1 parent bf4f87c commit d9fec14

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/utils/shallowEqual.spec.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,51 @@ describe('Utils', () => {
7070
)
7171
).toBe(false)
7272
})
73+
74+
75+
it('should compare two NaN values', () => {
76+
expect(
77+
shallowEqual(
78+
NaN,
79+
NaN
80+
)
81+
).toBe(true)
82+
})
83+
84+
it('should compare empty objects, with false', () => {
85+
expect(
86+
shallowEqual(
87+
{},
88+
false
89+
)
90+
).toBe(false)
91+
expect(
92+
shallowEqual(
93+
false,
94+
{}
95+
)
96+
).toBe(false)
97+
expect(
98+
shallowEqual(
99+
[],
100+
false
101+
)
102+
).toBe(false)
103+
expect(
104+
shallowEqual(
105+
false,
106+
[]
107+
)
108+
).toBe(false)
109+
})
110+
111+
it('should compare two zero values', () => {
112+
expect(
113+
shallowEqual(
114+
0,
115+
0
116+
)
117+
).toBe(true)
118+
})
73119
})
74120
})

0 commit comments

Comments
 (0)