refactor: split gateway server methods

This commit is contained in:
Peter Steinberger
2026-01-03 18:14:07 +01:00
parent 4a6b33d799
commit 73fa2e10bc
8 changed files with 3065 additions and 2860 deletions

View File

@@ -5,7 +5,9 @@ import { formatError, normalizeVoiceWakeTriggers } from "./server-utils.js";
describe("normalizeVoiceWakeTriggers", () => {
test("returns defaults when input is empty", () => {
expect(normalizeVoiceWakeTriggers([])).toEqual(defaultVoiceWakeTriggers());
expect(normalizeVoiceWakeTriggers(null)).toEqual(defaultVoiceWakeTriggers());
expect(normalizeVoiceWakeTriggers(null)).toEqual(
defaultVoiceWakeTriggers(),
);
});
test("trims and limits entries", () => {
@@ -20,8 +22,10 @@ describe("formatError", () => {
});
test("handles status/code", () => {
expect(formatError({ status: 500, code: "EPIPE" })).toBe("500 EPIPE");
expect(formatError({ status: 404 })).toBe("404");
expect(formatError({ code: "ENOENT" })).toBe("ENOENT");
expect(formatError({ status: 500, code: "EPIPE" })).toBe(
"status=500 code=EPIPE",
);
expect(formatError({ status: 404 })).toBe("status=404 code=unknown");
expect(formatError({ code: "ENOENT" })).toBe("status=unknown code=ENOENT");
});
});