Skip to content

Commit 80b833e

Browse files
authored
test(query-core/utils): assert exact booleans with 'toBe' instead of 'toEqual' (#11070)
1 parent a9aa23f commit 80b833e

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

packages/query-core/src/__tests__/utils.test.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,36 @@ describe('core/utils', () => {
4747

4848
describe('shallowEqualObjects', () => {
4949
it('should return `true` for shallow equal objects', () => {
50-
expect(shallowEqualObjects({ a: 1 }, { a: 1 })).toEqual(true)
50+
expect(shallowEqualObjects({ a: 1 }, { a: 1 })).toBe(true)
5151
})
5252

5353
it('should return `false` for non shallow equal objects', () => {
54-
expect(shallowEqualObjects({ a: 1 }, { a: 2 })).toEqual(false)
54+
expect(shallowEqualObjects({ a: 1 }, { a: 2 })).toBe(false)
5555
})
5656

5757
it('should return `false` if lengths are not equal', () => {
58-
expect(shallowEqualObjects({ a: 1 }, { a: 1, b: 2 })).toEqual(false)
58+
expect(shallowEqualObjects({ a: 1 }, { a: 1, b: 2 })).toBe(false)
5959
})
6060

6161
it('should return false if b is undefined', () => {
62-
expect(shallowEqualObjects({ a: 1 }, undefined)).toEqual(false)
62+
expect(shallowEqualObjects({ a: 1 }, undefined)).toBe(false)
6363
})
6464
})
6565
describe('isPlainObject', () => {
6666
it('should return `true` for a plain object', () => {
67-
expect(isPlainObject({})).toEqual(true)
67+
expect(isPlainObject({})).toBe(true)
6868
})
6969

7070
it('should return `false` for an array', () => {
71-
expect(isPlainObject([])).toEqual(false)
71+
expect(isPlainObject([])).toBe(false)
7272
})
7373

7474
it('should return `false` for null', () => {
75-
expect(isPlainObject(null)).toEqual(false)
75+
expect(isPlainObject(null)).toBe(false)
7676
})
7777

7878
it('should return `false` for undefined', () => {
79-
expect(isPlainObject(undefined)).toEqual(false)
79+
expect(isPlainObject(undefined)).toBe(false)
8080
})
8181

8282
it('should return `true` for object with an undefined constructor', () => {
@@ -117,55 +117,55 @@ describe('core/utils', () => {
117117

118118
describe('isPlainArray', () => {
119119
it('should return `true` for plain arrays', () => {
120-
expect(isPlainArray([1, 2])).toEqual(true)
120+
expect(isPlainArray([1, 2])).toBe(true)
121121
})
122122

123123
it('should return `false` for non plain arrays', () => {
124-
expect(isPlainArray(Object.assign([1, 2], { a: 'b' }))).toEqual(false)
124+
expect(isPlainArray(Object.assign([1, 2], { a: 'b' }))).toBe(false)
125125
})
126126
})
127127

128128
describe('partialMatchKey', () => {
129129
it('should return `true` if a includes b', () => {
130130
const a = [{ a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }] }]
131131
const b = [{ a: { b: 'b' }, c: 'c', d: [] }]
132-
expect(partialMatchKey(a, b)).toEqual(true)
132+
expect(partialMatchKey(a, b)).toBe(true)
133133
})
134134

135135
it('should return `false` if a does not include b', () => {
136136
const a = [{ a: { b: 'b' }, c: 'c', d: [] }]
137137
const b = [{ a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }] }]
138-
expect(partialMatchKey(a, b)).toEqual(false)
138+
expect(partialMatchKey(a, b)).toBe(false)
139139
})
140140

141141
it('should return `true` if array a includes array b', () => {
142142
const a = [1, 2, 3]
143143
const b = [1, 2]
144-
expect(partialMatchKey(a, b)).toEqual(true)
144+
expect(partialMatchKey(a, b)).toBe(true)
145145
})
146146

147147
it('should return `false` if a is null and b is not', () => {
148148
const a = [null]
149149
const b = [{ a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }] }]
150-
expect(partialMatchKey(a, b)).toEqual(false)
150+
expect(partialMatchKey(a, b)).toBe(false)
151151
})
152152

153153
it('should return `false` if a contains null and b is not', () => {
154154
const a = [{ a: null, c: 'c', d: [] }]
155155
const b = [{ a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }] }]
156-
expect(partialMatchKey(a, b)).toEqual(false)
156+
expect(partialMatchKey(a, b)).toBe(false)
157157
})
158158

159159
it('should return `false` if b is null and a is not', () => {
160160
const a = [{ a: { b: 'b' }, c: 'c', d: [] }]
161161
const b = [null]
162-
expect(partialMatchKey(a, b)).toEqual(false)
162+
expect(partialMatchKey(a, b)).toBe(false)
163163
})
164164

165165
it('should return `false` if b contains null and a is not', () => {
166166
const a = [{ a: { b: 'b' }, c: 'c', d: [] }]
167167
const b = [{ a: null, c: 'c', d: [{ d: 'd ' }] }]
168-
expect(partialMatchKey(a, b)).toEqual(false)
168+
expect(partialMatchKey(a, b)).toBe(false)
169169
})
170170

171171
it('should treat undefined object properties as matching missing properties', () => {
@@ -174,10 +174,10 @@ describe('core/utils', () => {
174174

175175
expect(
176176
partialMatchKey(queryKeyWithoutProperty, queryKeyWithUndefined),
177-
).toEqual(true)
177+
).toBe(true)
178178
expect(
179179
partialMatchKey(queryKeyWithUndefined, queryKeyWithoutProperty),
180-
).toEqual(true)
180+
).toBe(true)
181181
})
182182
})
183183

@@ -583,16 +583,16 @@ describe('core/utils', () => {
583583

584584
describe('isValidTimeout', () => {
585585
it('should accept valid timeout values', () => {
586-
expect(isValidTimeout(0)).toEqual(true)
587-
expect(isValidTimeout(1_000)).toEqual(true)
586+
expect(isValidTimeout(0)).toBe(true)
587+
expect(isValidTimeout(1_000)).toBe(true)
588588
})
589589

590590
it('should reject invalid timeout values', () => {
591-
expect(isValidTimeout(-1)).toEqual(false)
592-
expect(isValidTimeout(Number.NaN)).toEqual(false)
593-
expect(isValidTimeout(Number.POSITIVE_INFINITY)).toEqual(false)
594-
expect(isValidTimeout('1000')).toEqual(false)
595-
expect(isValidTimeout(undefined)).toEqual(false)
591+
expect(isValidTimeout(-1)).toBe(false)
592+
expect(isValidTimeout(Number.NaN)).toBe(false)
593+
expect(isValidTimeout(Number.POSITIVE_INFINITY)).toBe(false)
594+
expect(isValidTimeout('1000')).toBe(false)
595+
expect(isValidTimeout(undefined)).toBe(false)
596596
})
597597
})
598598

0 commit comments

Comments
 (0)