Skip to content

Commit 0706782

Browse files
committed
fix: Adjust node tests for changed happy-dom
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent f0dea21 commit 0706782

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/utils/clipboard.spec.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@ import { expect, describe, it, vi, beforeAll } from 'vitest'
66
import { copyToCipboard } from './clipboard'
77

88
describe('utils:clipboard', () => {
9-
beforeAll(() => {
10-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
11-
// @ts-ignore
12-
window.navigator.clipboard = {
13-
writeText: vi.fn(() => Promise.resolve()),
14-
}
15-
})
16-
179
it('writes to clipboard', () => {
10+
const spy = vi.spyOn(window.navigator.clipboard, 'writeText')
1811
const prompt = vi.spyOn(window, 'prompt').mockImplementation(() => '')
1912
copyToCipboard('foo bar')
20-
expect(window.navigator.clipboard.writeText).toBeCalledWith('foo bar')
13+
expect(spy).toBeCalledWith('foo bar')
2114
expect(prompt).not.toBeCalled()
2215
})
2316

0 commit comments

Comments
 (0)