Skip to content

Commit 3294e50

Browse files
chore: update tests to use expect.toBeInstanceOf (#8154)
1 parent 6b194bc commit 3294e50

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

packages/reactivity/__tests__/collections/Map.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ describe('reactivity/collections', () => {
1414
const original = new Map()
1515
const observed = reactive(original)
1616
expect(isReactive(observed)).toBe(true)
17-
expect(original instanceof Map).toBe(true)
18-
expect(observed instanceof Map).toBe(true)
17+
expect(original).toBeInstanceOf(Map)
18+
expect(observed).toBeInstanceOf(Map)
1919
})
2020

2121
it('should observe mutations', () => {

packages/reactivity/__tests__/collections/Set.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ describe('reactivity/collections', () => {
1414
const original = new Set()
1515
const observed = reactive(original)
1616
expect(isReactive(observed)).toBe(true)
17-
expect(original instanceof Set).toBe(true)
18-
expect(observed instanceof Set).toBe(true)
17+
expect(original).toBeInstanceOf(Set)
18+
expect(observed).toBeInstanceOf(Set)
1919
})
2020

2121
it('should observe mutations', () => {

packages/reactivity/__tests__/collections/WeakMap.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ describe('reactivity/collections', () => {
77
const original = new WeakMap()
88
const observed = reactive(original)
99
expect(isReactive(observed)).toBe(true)
10-
expect(original instanceof WeakMap).toBe(true)
11-
expect(observed instanceof WeakMap).toBe(true)
10+
expect(original).toBeInstanceOf(WeakMap)
11+
expect(observed).toBeInstanceOf(WeakMap)
1212
})
1313

1414
it('should observe mutations', () => {

packages/reactivity/__tests__/collections/WeakSet.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ describe('reactivity/collections', () => {
77
const original = new WeakSet()
88
const observed = reactive(original)
99
expect(isReactive(observed)).toBe(true)
10-
expect(original instanceof WeakSet).toBe(true)
11-
expect(observed instanceof WeakSet).toBe(true)
10+
expect(original).toBeInstanceOf(WeakSet)
11+
expect(observed).toBeInstanceOf(WeakSet)
1212
})
1313

1414
it('should observe mutations', () => {

packages/reactivity/__tests__/reactive.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('reactivity/reactive', () => {
5050
class CustomMap extends Map {}
5151
const cmap = reactive(new CustomMap())
5252

53-
expect(cmap instanceof Map).toBe(true)
53+
expect(cmap).toBeInstanceOf(Map)
5454
expect(isReactive(cmap)).toBe(true)
5555

5656
cmap.set('key', {})
@@ -60,7 +60,7 @@ describe('reactivity/reactive', () => {
6060
class CustomSet extends Set {}
6161
const cset = reactive(new CustomSet())
6262

63-
expect(cset instanceof Set).toBe(true)
63+
expect(cset).toBeInstanceOf(Set)
6464
expect(isReactive(cset)).toBe(true)
6565

6666
let dummy
@@ -77,7 +77,7 @@ describe('reactivity/reactive', () => {
7777
class CustomMap extends WeakMap {}
7878
const cmap = reactive(new CustomMap())
7979

80-
expect(cmap instanceof WeakMap).toBe(true)
80+
expect(cmap).toBeInstanceOf(WeakMap)
8181
expect(isReactive(cmap)).toBe(true)
8282

8383
const key = {}
@@ -88,7 +88,7 @@ describe('reactivity/reactive', () => {
8888
class CustomSet extends WeakSet {}
8989
const cset = reactive(new CustomSet())
9090

91-
expect(cset instanceof WeakSet).toBe(true)
91+
expect(cset).toBeInstanceOf(WeakSet)
9292
expect(isReactive(cset)).toBe(true)
9393

9494
let dummy

packages/runtime-dom/__tests__/createApp.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('createApp for dom', () => {
1111
}
1212
}).mount(root)
1313
expect(root.children.length).toBe(1)
14-
expect(root.children[0] instanceof SVGElement).toBe(true)
14+
expect(root.children[0]).toBeInstanceOf(SVGElement)
1515
})
1616

1717
// #4398

packages/vue-compat/__tests__/filters.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('FILTERS', () => {
116116
}
117117
}
118118
}).$mount() as any
119-
expect(vm.$refs.test.pattern instanceof RegExp).toBe(true)
119+
expect(vm.$refs.test.pattern).toBeInstanceOf(RegExp)
120120
expect(vm.$refs.test.pattern.toString()).toBe('/a|b\\//')
121121
expect(CompilerDeprecationTypes.COMPILER_FILTERS).toHaveBeenWarned()
122122
})

0 commit comments

Comments
 (0)