feat(test): add PreferencesForm component tests

This commit is contained in:
Phan An 2022-05-09 12:21:21 +02:00
parent e811509176
commit bf7a3130ae
No known key found for this signature in database
GPG key ID: A81E4477F0BB6FDC

View file

@ -0,0 +1,20 @@
import { expect, it } from 'vitest'
import isMobile from 'ismobilejs'
import ComponentTestCase from '@/__tests__/ComponentTestCase'
import PreferencesForm from './PreferencesForm.vue'
new class extends ComponentTestCase {
protected test () {
it('has "Transcode on mobile" option for mobile users', () => {
isMobile.phone = true
const { getByLabelText } = this.render(PreferencesForm)
getByLabelText('Convert and play media at 128kbps on mobile')
})
it('does not have "Transcode on mobile" option for non-mobile users', async () => {
isMobile.phone = false
const { queryByLabelText } = this.render(PreferencesForm)
expect(await queryByLabelText('Convert and play media at 128kbps on mobile')).toBeNull()
})
}
}