Fixed Bug in Status Overview
This commit is contained in:
@@ -59,4 +59,18 @@ describe("getVehicleDisplayStatus", () => {
|
||||
};
|
||||
expect(getVehicleDisplayStatus(vehicle)).toBe("Updating");
|
||||
});
|
||||
|
||||
it("should handle microsecond precision timestamps", () => {
|
||||
// Backend sends 6 digit precision e.g. .991694
|
||||
// 2024-01-01T12:00:04.991694 -> 6s ago
|
||||
const vehicle: Vehicle = {
|
||||
vin: "TEST",
|
||||
status: "Online",
|
||||
currentVersion: "1.0",
|
||||
lastHeartbeat: "2024-01-01T12:00:04.991694",
|
||||
groupId: null
|
||||
};
|
||||
// If it parses correctly, diff is ~6s > 5s -> Offline
|
||||
expect(getVehicleDisplayStatus(vehicle)).toBe("Offline");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user