feat: add direct car telemetry management

This commit is contained in:
2026-07-31 23:14:40 +02:00
parent 530162cbf7
commit e347a581e1
16 changed files with 447 additions and 57 deletions
+33
View File
@@ -259,6 +259,12 @@ describe("authentication boundary", () => {
expect((await app.inject({ method: "GET", url: "/api/car/statistics" })).statusCode).toBe(401);
const token = await csrf(app);
expect((await app.inject({
method: "POST",
url: "/api/car/history/clear",
headers: mutationHeaders(token),
payload: { mode: "history" }
})).statusCode).toBe(401);
await setup(app, token);
const login = await app.inject({
method: "POST",
@@ -276,6 +282,33 @@ describe("authentication boundary", () => {
const invalidPeriod = await app.inject({ method: "GET", url: "/api/car/history?period=forever", headers: { cookie } });
expect(invalidPeriod.statusCode).toBe(400);
const invalidClear = await app.inject({
method: "POST",
url: "/api/car/history/clear",
headers,
payload: { mode: "recent" }
});
expect(invalidClear.statusCode).toBe(400);
expect(invalidClear.json()).toMatchObject({ error: { code: "INVALID_CLEAR_TELEMETRY_MODE" } });
const clearHistory = await app.inject({
method: "POST",
url: "/api/car/history/clear",
headers,
payload: { mode: "history" }
});
expect(clearHistory.statusCode).toBe(200);
expect(clearHistory.json()).toEqual({ mode: "history", deletedSamples: 0, deletedRollups: 0 });
const clearAll = await app.inject({
method: "POST",
url: "/api/car/history/clear",
headers,
payload: { mode: "all" }
});
expect(clearAll.statusCode).toBe(200);
expect(clearAll.json()).toEqual({ mode: "all", deletedSamples: 0, deletedRollups: 0 });
const invalid = await app.inject({
method: "POST",
url: "/api/adb/shortcuts",