Add dashboard Bluetooth controls

This commit is contained in:
2026-07-31 23:47:20 +02:00
parent af9de7dbdf
commit 3801a91acf
14 changed files with 301 additions and 6 deletions
+12
View File
@@ -356,6 +356,18 @@ describe("authentication boundary", () => {
const webHeaders = { ...mutationHeaders(csrfToken), cookie };
expect((await app.inject({ method: "GET", url: "/api/mobile/devices" })).statusCode).toBe(401);
expect((await app.inject({ method: "GET", url: "/api/mobile/bluetooth" })).statusCode).toBe(401);
const bluetooth = await app.inject({ method: "GET", url: "/api/mobile/bluetooth", headers: { cookie } });
expect(bluetooth.statusCode).toBe(200);
expect(bluetooth.json()).toMatchObject({ powered: expect.any(Boolean), discoverable: expect.any(Boolean) });
const invalidBluetoothAction = await app.inject({
method: "POST",
url: "/api/mobile/bluetooth",
headers: webHeaders,
payload: { action: "arbitrary-command" }
});
expect(invalidBluetoothAction.statusCode).toBe(400);
expect(invalidBluetoothAction.json()).toMatchObject({ error: { code: "INVALID_BLUETOOTH_ACTION" } });
const pairing = await app.inject({ method: "POST", url: "/api/mobile/pairing", headers: webHeaders });
expect(pairing.statusCode).toBe(200);
const code = pairing.json<{ code: string }>().code;