- useApiFetch: typed fetch wrapper with network/http error discrimination - useMotion: reactive localStorage override for rich-animation toggle, respects OS prefers-reduced-motion - useHaptics: label/discard/skip/undo vibration patterns, gated on rich mode - useKonamiCode + useHackerMode: 10-key Konami sequence → hacker theme, persisted in localStorage - test-setup.ts: jsdom matchMedia stub so useMotion imports cleanly in Vitest - smoke.test.ts: import smoke tests for all 4 composables (12 tests, all passing)
30 lines
894 B
TypeScript
30 lines
894 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
|
|
describe('scaffold', () => {
|
|
it('vitest works', () => {
|
|
expect(1 + 1).toBe(2)
|
|
})
|
|
})
|
|
|
|
describe('composable imports', () => {
|
|
it('useApi imports', async () => {
|
|
const { useApiFetch } = await import('./composables/useApi')
|
|
expect(typeof useApiFetch).toBe('function')
|
|
})
|
|
|
|
it('useMotion imports', async () => {
|
|
const { useMotion } = await import('./composables/useMotion')
|
|
expect(typeof useMotion).toBe('function')
|
|
})
|
|
|
|
it('useHaptics imports', async () => {
|
|
const { useHaptics } = await import('./composables/useHaptics')
|
|
expect(typeof useHaptics).toBe('function')
|
|
})
|
|
|
|
it('useEasterEgg imports', async () => {
|
|
const { useKonamiCode, useHackerMode } = await import('./composables/useEasterEgg')
|
|
expect(typeof useKonamiCode).toBe('function')
|
|
expect(typeof useHackerMode).toBe('function')
|
|
})
|
|
})
|