fix(domain): 移除虚构 SoH 趋势语义

This commit is contained in:
2026-05-12 00:07:15 +08:00
parent e9568bca8c
commit 5d9aa660d8
2 changed files with 80 additions and 75 deletions
+16 -1
View File
@@ -65,6 +65,12 @@ describe('battery domain', () => {
expect(snapshot.devices.every((device) => device.soh === null)).toBe(true)
expect(snapshot.devices.every((device) => device.soh30d === null)).toBe(true)
expect(snapshot.devices.every((device) => device.soh90d === null)).toBe(true)
expect(snapshot.devices.every((device) => device.soh60d === null)).toBe(true)
expect(snapshot.devices.every((device) => device.cycles === 0)).toBe(true)
expect(snapshot.devices.every((device) => device.temperature === 0)).toBe(true)
expect(snapshot.devices.every((device) => device.chargeEfficiency === 0)).toBe(true)
expect(snapshot.devices[0]?.firmware).toBe('v3.8.2')
expect(snapshot.devices[1]?.firmware).toBe('未提供')
expect(snapshot.soh.history).toHaveLength(0)
expect(snapshot.soh.forecast).toHaveLength(0)
expect(snapshot.summary.totalDevices).toBe(snapshot.devices.length)
@@ -106,7 +112,16 @@ describe('battery domain', () => {
expect(predicted?.sohSource).toBe('prediction')
expect(predicted?.soh30d).toBe(58)
expect(predicted?.soh90d).toBe(52)
expect(predicted?.soh60d).toBeNull()
expect(predicted?.cycles).toBe(6)
expect(predicted?.firmware).toBe('v3.8.2')
expect(predicted?.status).toBe(DEVICE_STATUS.WARNING)
expect(predicted?.firmware).toBe('XGBoost')
expect(predicted?.temperature).toBe(0)
expect(predicted?.chargeEfficiency).toBe(0)
expect(snapshot.soh.history).toHaveLength(0)
expect(snapshot.soh.forecast).toHaveLength(3)
expect(snapshot.soh.forecast[0]).toEqual({ month: '当前', value: 60 })
expect(snapshot.soh.forecast[1]).toEqual({ month: '30天', value: 58 })
expect(snapshot.soh.forecast[2]).toEqual({ month: '90天', value: 52 })
})
})