2024-01-15 22:26:50 +00:00
|
|
|
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 {
|
|
|
|
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'))
|
2024-10-13 17:37:01 +00:00
|
|
|
expect(globalThis.LemonSqueezy.Url.Open).toHaveBeenCalledWith(
|
|
|
|
'https://store.koel.dev/checkout/buy/42?embed=1&media=0&desc=0',
|
2024-01-15 22:26:50 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
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')
|
|
|
|
})
|
|
|
|
}
|
2024-04-23 21:01:27 +00:00
|
|
|
|
|
|
|
private renderComponent () {
|
|
|
|
return this.render(Modal)
|
|
|
|
}
|
2024-01-15 22:26:50 +00:00
|
|
|
}
|