Add dashboard Bluetooth controls
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user