import { describe, it, expect } from 'vitest' type LogItem = { id: string timestamp: string machineId: string programName: string level: string message: string } type DashboardData = { total: number counts: Record logs: LogItem[] analysis?: string } describe('日志看板数据结构', () => { it('应包含 logs、counts、total 字段且类型正确', () => { const sample: DashboardData = { total: 5, counts: { ERROR: 1, INFO: 4 }, logs: [ { id: 'l1', timestamp: '2026-05-01T12:00:00Z', machineId: 'M1', programName: 'ProgA', level: 'ERROR', message: 'Something failed' } ], analysis: '最近一次采集无显著趋势' } expect(sample).toHaveProperty('logs') expect(sample).toHaveProperty('counts') expect(typeof sample.total).toBe('number') }) })