mirror of
https://github.com/koel/koel
synced 2024-12-20 09:33:23 +00:00
33 lines
1 KiB
TypeScript
33 lines
1 KiB
TypeScript
|
import { screen } from '@testing-library/vue'
|
||
|
import { commonStore } from '@/stores'
|
||
|
import { expect, it } from 'vitest'
|
||
|
import UnitTestCase from '@/__tests__/UnitTestCase'
|
||
|
import Modal from './KoelPlusModal.vue'
|
||
|
|
||
|
new class extends UnitTestCase {
|
||
|
private renderComponent () {
|
||
|
return this.render(Modal)
|
||
|
}
|
||
|
|
||
|
protected test () {
|
||
|
it('shows button to purchase Koel Plus', async () => {
|
||
|
commonStore.state.koel_plus.product_id = '42'
|
||
|
this.renderComponent()
|
||
|
|
||
|
screen.getByTestId('buttons')
|
||
|
expect(screen.queryByTestId('activateForm')).toBeNull()
|
||
|
await this.user.click(screen.getByText('Purchase Koel Plus'))
|
||
|
expect(global.LemonSqueezy.Url.Open).toHaveBeenCalledWith(
|
||
|
'https://store.plus.koel.dev/checkout/buy/42?embed=1&media=0&desc=0'
|
||
|
)
|
||
|
})
|
||
|
|
||
|
it('shows form to activate Koel Plus', async () => {
|
||
|
commonStore.state.koel_plus.product_id = '42'
|
||
|
this.renderComponent()
|
||
|
await this.user.click(screen.getByText('I have a license key'))
|
||
|
screen.getByTestId('activateForm')
|
||
|
})
|
||
|
}
|
||
|
}
|