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
This commit is contained in:
@@ -3,16 +3,23 @@ import { setActivePinia, createPinia } from 'pinia'
|
||||
import { useOperationsStore } from '../src/stores/operations'
|
||||
|
||||
describe('operations store', () => {
|
||||
it('initializes with fallback data', () => {
|
||||
it('initializes with safe fallback structure', () => {
|
||||
setActivePinia(createPinia())
|
||||
const store = useOperationsStore()
|
||||
expect(store.snapshot.metrics.activeAgents).toBeGreaterThan(0)
|
||||
// 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('has routing targets', () => {
|
||||
it('initializes routing as empty array', () => {
|
||||
setActivePinia(createPinia())
|
||||
const store = useOperationsStore()
|
||||
expect(store.routing.length).toBeGreaterThan(0)
|
||||
expect(Array.isArray(store.routing)).toBe(true)
|
||||
expect(store.routing.length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user