mirror of
https://github.com/koel/koel
synced 2024-12-21 01:53:11 +00:00
23 lines
715 B
TypeScript
23 lines
715 B
TypeScript
|
import { screen } from '@testing-library/vue'
|
||
|
import { expect, it } from 'vitest'
|
||
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
||
|
import { plusService } from '@/services'
|
||
|
import Form from './ActivateLicenseForm.vue'
|
||
|
|
||
|
new class extends UnitTestCase {
|
||
|
private renderComponent () {
|
||
|
return this.render(Form )
|
||
|
}
|
||
|
|
||
|
protected test () {
|
||
|
it('activates license', async () => {
|
||
|
this.renderComponent()
|
||
|
const activateMock = this.mock(plusService, 'activateLicense').mockResolvedValueOnce('')
|
||
|
|
||
|
await this.type(screen.getByRole('textbox'), 'my-license-key')
|
||
|
await this.user.click(screen.getByText('Activate'))
|
||
|
expect(activateMock).toHaveBeenCalledWith('my-license-key')
|
||
|
})
|
||
|
}
|
||
|
}
|