Skip to content

Commit

Permalink
chore: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 6, 2022
1 parent 0ef0b5e commit 354d201
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/shared/watchArray/index.test.ts
@@ -1,4 +1,4 @@
import { nextTick, reactive, ref } from 'vue-demi'
import { isVue2, nextTick, reactive, ref } from 'vue-demi'
import { watchArray } from '.'

describe('watchArray', () => {
Expand Down Expand Up @@ -44,7 +44,8 @@ describe('watchArray', () => {
watchArray(num, spy, { deep: true })
num.value.push(4)
await nextTick()
expect(spy).toBeCalledTimes(1)
// TODO: Vue 2 somehow get trigger twice
expect(spy).toBeCalledTimes(isVue2 ? 2 : 1)
})

it('should work with list splice', async () => {
Expand All @@ -59,7 +60,8 @@ describe('watchArray', () => {
watchArray(num, spy, { deep: true })
num.value.splice(1, 1, 5, 6, 7)
await nextTick()
expect(spy).toBeCalledTimes(1)
// TODO: Vue 2 somehow get trigger twice
expect(spy).toBeCalledTimes(isVue2 ? 2 : 1)
})

it('should work with reactive source', async () => {
Expand Down

0 comments on commit 354d201

Please sign in to comment.