mirror of
https://github.com/koel/koel
synced 2024-09-20 06:11:53 +00:00
fix(tests): unsupported clipboard in certain environment
This commit is contained in:
parent
4ec274d1a6
commit
d73028fb0c
2 changed files with 7 additions and 2 deletions
|
@ -56,3 +56,9 @@ window.SSO_PROVIDERS = []
|
|||
window.createLemonSqueezy = vi.fn()
|
||||
|
||||
Axios.defaults.adapter = vi.fn()
|
||||
|
||||
Object.assign(navigator, {
|
||||
clipboard: {
|
||||
writeText: vi.fn()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -9,7 +9,6 @@ new class extends UnitTestCase {
|
|||
protected test () {
|
||||
it('works', async () => {
|
||||
this.mock(playlistCollaborationService, 'createInviteLink').mockResolvedValue('http://localhost:3000/invite/1234')
|
||||
const writeTextMock = this.mock(navigator.clipboard, 'writeText')
|
||||
const playlist = factory('playlist')
|
||||
|
||||
this.render(Component, {
|
||||
|
@ -21,7 +20,7 @@ new class extends UnitTestCase {
|
|||
await this.user.click(screen.getByText('Invite'))
|
||||
|
||||
await waitFor(async () => {
|
||||
expect(writeTextMock).toHaveBeenCalledWith('http://localhost:3000/invite/1234')
|
||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('http://localhost:3000/invite/1234')
|
||||
screen.getByText('Link copied to clipboard!')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue