Skip to content

Commit

Permalink
Simplify unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pleek91 committed Nov 16, 2023
1 parent 7ec4b7f commit a37a9cb
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/useSubscription/useSubscriptionWithDependencies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,23 @@ import { useSubscriptionWithDependencies } from '@/useSubscription/useSubscripti
import { timeout } from '@/utilities/tests'

test('it does not execute the action when args have not changed', async () => {
const number = ref(0)
const object = ref({ value: 0 })
const action = vi.fn()

const parameters = computed(() => [
number.value,
object.value,
])
const parameters = computed(() => [object.value])

useSubscriptionWithDependencies(action, parameters)

await timeout()

expect(action).toBeCalledTimes(1)

number.value = 1
object.value = { value: 1 }

await timeout()

expect(action).toBeCalledTimes(2)

number.value = 1
object.value = { value: 1 }

await timeout()
Expand Down

0 comments on commit a37a9cb

Please sign in to comment.