koel/resources/assets/js/components/profile-preferences/PreferencesForm.spec.ts

21 lines
753 B
TypeScript
Raw Normal View History

import { expect, it } from 'vitest'
import isMobile from 'ismobilejs'
2022-05-13 17:58:38 +00:00
import UnitTestCase from '@/__tests__/UnitTestCase'
import PreferencesForm from './PreferencesForm.vue'
2022-05-13 17:58:38 +00:00
new class extends UnitTestCase {
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()
})
}
}