Skip to content

Commit eaa6f49

Browse files
committed
test: use expect.poll
1 parent 841ade4 commit eaa6f49

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

test/reply.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ChatInputCommandInteraction } from 'discord.js'
22
import type { DiscordClient } from '~/src/runtime/server/utils/client'
33
import { MessageFlags } from 'discord.js'
44
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
5-
import { effectScope, nextTick, ref } from 'vue'
5+
import { effectScope, ref } from 'vue'
66
import { reply } from '../src/runtime/server/utils/reply'
77

88
declare module 'vue' {
@@ -103,10 +103,7 @@ describe('reply', () => {
103103
content: 'This is a reply!',
104104
})
105105
content.value = 'Updated reply!'
106-
await nextTick()
107-
// wait for next tick to ensure the watcher has run
108-
await Promise.resolve()
109-
expect(mockEditFunction).toHaveBeenCalledExactlyOnceWith({
106+
await expect.poll(() => mockEditFunction).toHaveBeenCalledExactlyOnceWith({
110107
content: 'Updated reply!',
111108
})
112109
})

0 commit comments

Comments
 (0)