Files
nexus/frontend/tests/operations.test.ts
reviewer 6cedd8410f
CI - Build & Test / Backend (.NET) (push) Failing after 23s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 16s
CI - Build & Test / Security Check (push) Successful in 3s
refactor(frontend): deduplicate CSS keyframes, unify types, extract format utils, add UI states, trim mock data
- Remove duplicate @keyframes pulse-* from 3 component files (already in nexus-tokens.css)
- Rename AgentDetail → AgentDetailData in dashboard types to avoid collision with types/agent.ts
- Extract shared formatNumber/initials/formatTime to utils/format.ts
- Simplify FlowBoard: use agentStore modal/selection getters instead of duplicating local state
- Add error banner + empty state to IrisChat; add loading skeleton + error/empty states to TaskStrip
- Remove 105-line unused mockAgents array from useFlowLayout
- Reduce operations store fallbacks from hardcoded preview data to minimal safe defaults
- Update operations store tests to match lean fallback structure
- Net: -73 lines, cleaner imports, fewer magic strings
2026-06-12 17:02:50 +02:00

26 lines
1017 B
TypeScript

import { describe, it, expect } from 'vitest'
import { setActivePinia, createPinia } from 'pinia'
import { useOperationsStore } from '../src/stores/operations'
describe('operations store', () => {
it('initializes with safe fallback structure', () => {
setActivePinia(createPinia())
const store = useOperationsStore()
// Fallback provides a valid structure even when API is down
expect(store.snapshot).toBeDefined()
expect(store.snapshot.runtime.runtime).toBe('OpenClaw')
expect(store.snapshot.metrics).toBeDefined()
expect(Array.isArray(store.snapshot.projects)).toBe(true)
expect(Array.isArray(store.snapshot.tasks)).toBe(true)
expect(Array.isArray(store.snapshot.activity)).toBe(true)
expect(Array.isArray(store.snapshot.models)).toBe(true)
})
it('initializes routing as empty array', () => {
setActivePinia(createPinia())
const store = useOperationsStore()
expect(Array.isArray(store.routing)).toBe(true)
expect(store.routing.length).toBe(0)
})
})