feat(dashboard): 接入预测结果聚合
This commit is contained in:
@@ -59,4 +59,37 @@ describe('battery domain', () => {
|
||||
snapshot.devices.length,
|
||||
)
|
||||
})
|
||||
|
||||
test('uses AI prediction values when available', () => {
|
||||
const now = new Date('2026-05-11T00:00:00.000Z')
|
||||
const items = rows.map(toBatteryInfo)
|
||||
const snapshot = createDashboardSnapshot(
|
||||
items,
|
||||
now,
|
||||
new Map([
|
||||
[
|
||||
'RING-A03',
|
||||
{
|
||||
mac: 'RING-A03',
|
||||
nowSoh: 60,
|
||||
monthSoh: 58,
|
||||
trmonthSoh: 52,
|
||||
riskScore: 40,
|
||||
riskLevel: 'high',
|
||||
status: '危险',
|
||||
modelName: 'XGBoost',
|
||||
cyclesUsed: 6,
|
||||
updatedAt: '2026-05-11T00:00:00.000Z',
|
||||
},
|
||||
],
|
||||
]),
|
||||
)
|
||||
const predicted = snapshot.devices.find((device) => device.id === 'RING-A03')
|
||||
|
||||
expect(predicted?.soh).toBe(60)
|
||||
expect(predicted?.soh30d).toBe(58)
|
||||
expect(predicted?.soh90d).toBe(52)
|
||||
expect(predicted?.status).toBe('预警')
|
||||
expect(predicted?.firmware).toBe('XGBoost')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user