koel/resources/assets/js/stores/settingStore.spec.ts

20 lines
596 B
TypeScript
Raw Normal View History

2022-07-23 11:10:41 +00:00
import { expect, it } from 'vitest'
import UnitTestCase from '@/__tests__/UnitTestCase'
import { http } from '@/services'
2022-09-14 16:45:08 +00:00
import { settingStore } from '.'
2022-07-23 11:10:41 +00:00
new class extends UnitTestCase {
protected test () {
it('initializes the store', () => {
settingStore.init({ media_path: '/media/path' })
expect(settingStore.state.media_path).toEqual('/media/path')
})
it('updates the media path', async () => {
this.mock(http, 'put')
2022-07-23 11:10:41 +00:00
await settingStore.update({ media_path: '/dev/null' })
expect(settingStore.state.media_path).toEqual('/dev/null')
})
}
}