- Added new dependencies: `adler2`, `crc32fast`, `flate2`, `miniz_oxide`, and `libredox`. - Updated existing dependencies: `tokio-rustls` to version 0.26.4 and `filetime` to version 0.2.27. - Removed the `backup.rs` file as it is no longer needed. - Introduced tests for configuration and credential management. - Enhanced the `identity` module to generate W3C compliant DID documents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
import { setActivePinia, createPinia } from 'pinia'
|
|
|
|
vi.mock('@/composables/useNavSounds', () => ({
|
|
playNavSound: vi.fn(),
|
|
}))
|
|
|
|
import { useCLIStore } from '../cli'
|
|
import { playNavSound } from '@/composables/useNavSounds'
|
|
|
|
const mockedPlayNavSound = vi.mocked(playNavSound)
|
|
|
|
describe('useCLIStore', () => {
|
|
beforeEach(() => {
|
|
setActivePinia(createPinia())
|
|
vi.clearAllMocks()
|
|
})
|
|
|
|
it('starts closed', () => {
|
|
const store = useCLIStore()
|
|
expect(store.isOpen).toBe(false)
|
|
})
|
|
|
|
it('open sets isOpen to true and plays sound', () => {
|
|
const store = useCLIStore()
|
|
store.open()
|
|
expect(store.isOpen).toBe(true)
|
|
expect(mockedPlayNavSound).toHaveBeenCalledWith('action')
|
|
})
|
|
|
|
it('close sets isOpen to false without sound', () => {
|
|
const store = useCLIStore()
|
|
store.open()
|
|
vi.clearAllMocks()
|
|
store.close()
|
|
expect(store.isOpen).toBe(false)
|
|
expect(mockedPlayNavSound).not.toHaveBeenCalled()
|
|
})
|
|
|
|
it('toggle opens and plays sound when closed', () => {
|
|
const store = useCLIStore()
|
|
store.toggle()
|
|
expect(store.isOpen).toBe(true)
|
|
expect(mockedPlayNavSound).toHaveBeenCalledWith('action')
|
|
})
|
|
|
|
it('toggle closes without sound when open', () => {
|
|
const store = useCLIStore()
|
|
store.open()
|
|
vi.clearAllMocks()
|
|
store.toggle()
|
|
expect(store.isOpen).toBe(false)
|
|
expect(mockedPlayNavSound).not.toHaveBeenCalled()
|
|
})
|
|
|
|
it('multiple toggles alternate state', () => {
|
|
const store = useCLIStore()
|
|
store.toggle()
|
|
expect(store.isOpen).toBe(true)
|
|
store.toggle()
|
|
expect(store.isOpen).toBe(false)
|
|
store.toggle()
|
|
expect(store.isOpen).toBe(true)
|
|
})
|
|
})
|