29 lines
770 B
TypeScript
29 lines
770 B
TypeScript
import { beforeEach, describe, expect, it } from 'vitest'
|
|
import { createPinia, setActivePinia } from 'pinia'
|
|
import { useConfigStore } from '../stores/config'
|
|
|
|
describe('config store', () => {
|
|
beforeEach(() => {
|
|
setActivePinia(createPinia())
|
|
})
|
|
|
|
it('reads config values by key', () => {
|
|
const store = useConfigStore()
|
|
store.setConfigs([
|
|
{ key: 'archive.outputDir', value: '/music/archive', sensitive: false, group: 'archive' }
|
|
])
|
|
|
|
expect(store.getValue('archive.outputDir')).toBe('/music/archive')
|
|
})
|
|
|
|
it('tracks loading state transitions', async () => {
|
|
const store = useConfigStore()
|
|
|
|
await store.runWithLoading(async () => {
|
|
expect(store.isLoading).toBe(true)
|
|
})
|
|
|
|
expect(store.isLoading).toBe(false)
|
|
})
|
|
})
|