From 4d6e1bbf258c9d1fded600ba61fa67a279c1471a Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Wed, 23 Sep 2026 17:36:11 +0200 Subject: [PATCH] fix: tests --- .../components/input/https-json/integration.ts | 12 ++++++------ tests/components/input/https/integration.ts | 8 ++++---- tests/components/input/icecast/integration.ts | 18 +++++++++--------- .../input/opensubsonic/integration.ts | 12 ++++++------ tests/components/input/webdav/integration.ts | 12 ++++++------ 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/components/input/https-json/integration.ts b/tests/components/input/https-json/integration.ts index c66a3ce3..4721be5c 100644 --- a/tests/components/input/https-json/integration.ts +++ b/tests/components/input/https-json/integration.ts @@ -56,21 +56,21 @@ describe("components/input/https-json (integration)", () => { expect(parsed?.server.dir).toBe("/music"); }); - it("consult returns true when the server responds ok", async () => { + it('consult returns "yes" when the server responds ok', async () => { const uri = buildURI({ host: `127.0.0.1:${port}`, dir: "/" }, ""); const result = await Worker.consult(uri); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(true); + expect(result.consult).toBe("yes"); } }); - it("consult returns false when the server is unreachable", async () => { + it('consult returns "no" when the server is unreachable', async () => { const uri = buildURI({ host: `127.0.0.1:${port + 9999}`, dir: "/" }, ""); const result = await Worker.consult(uri); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(false); + expect(result.consult).toBe("no"); } }); @@ -155,7 +155,7 @@ describe("components/input/https-json (integration)", () => { const result = await Worker.groupConsult([uri]); const keys = Object.keys(result); expect(keys.length).toBe(1); - expect(result[keys[0]].available).toBe(true); + expect(result[keys[0]].available).toBe("yes"); }); it("groupConsult reports unavailable for an unreachable server", async () => { @@ -163,7 +163,7 @@ describe("components/input/https-json (integration)", () => { const result = await Worker.groupConsult([uri]); const keys = Object.keys(result); expect(keys.length).toBe(1); - expect(result[keys[0]].available).toBe(false); + expect(result[keys[0]].available).toBe("no"); }); it("detach with scheme removes all https-json tracks", async () => { diff --git a/tests/components/input/https/integration.ts b/tests/components/input/https/integration.ts index ab3dd8d2..8c1243ee 100644 --- a/tests/components/input/https/integration.ts +++ b/tests/components/input/https/integration.ts @@ -31,12 +31,12 @@ describe("components/input/https (integration)", () => { expect(resolved).toBe(undefined); }); - it("consult returns false for an unreachable host", async () => { + it('consult returns "no" for an unreachable host', async () => { // Port 1 on localhost — nothing listens, connection refused. const result = await Worker.consult("https://127.0.0.1:1/audio.mp3"); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(false); + expect(result.consult).toBe("no"); } }); @@ -77,8 +77,8 @@ describe("components/input/https (integration)", () => { "https://127.0.0.1:1/b.mp3", ]); const key = "https://127.0.0.1:1"; - expect(result[key]?.available).toBe(false); - if (!result[key]?.available) { + expect(result[key]?.available).toBe("no"); + if (result[key]?.available === "no") { expect(result[key]?.reason).toBeDefined(); } expect(result[key]?.uris).toEqual([ diff --git a/tests/components/input/icecast/integration.ts b/tests/components/input/icecast/integration.ts index 5f452f90..7dcfce71 100644 --- a/tests/components/input/icecast/integration.ts +++ b/tests/components/input/icecast/integration.ts @@ -70,27 +70,27 @@ afterAll(async () => { }); describe("components/input/icecast (integration)", () => { - it("consult returns true for a live stream with ICY metadata", async () => { + it('consult returns "yes" for a live stream with ICY metadata', async () => { const result = await Worker.consult(`icecast://127.0.0.1:${goodPort}/stream.mp3?tls=0`); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(true); + expect(result.consult).toBe("yes"); } }); - it("consult returns false for a stream without icy-metaint", async () => { + it('consult returns "no" for a stream without icy-metaint', async () => { const result = await Worker.consult(`icecast://127.0.0.1:${plainPort}/noicy?tls=0`); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(false); + expect(result.consult).toBe("no"); } }); - it("consult returns false for an unreachable host", async () => { + it('consult returns "no" for an unreachable host', async () => { const result = await Worker.consult(`icecast://127.0.0.1:${deadPort}/stream.mp3?tls=0`); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(false); + expect(result.consult).toBe("no"); } }); @@ -134,7 +134,7 @@ describe("components/input/icecast (integration)", () => { `icecast://127.0.0.1:${goodPort}/stream.mp3?tls=0`, ]); const key = `icecast://127.0.0.1:${goodPort}`; - expect(result[key]?.available).toBe(true); + expect(result[key]?.available).toBe("yes"); expect(result[key]?.uris).toEqual([ `icecast://127.0.0.1:${goodPort}/stream.mp3?tls=0`, ]); @@ -145,8 +145,8 @@ describe("components/input/icecast (integration)", () => { `icecast://127.0.0.1:${deadPort}/stream.mp3?tls=0`, ]); const key = `icecast://127.0.0.1:${deadPort}`; - expect(result[key]?.available).toBe(false); - if (!result[key]?.available) { + expect(result[key]?.available).toBe("no"); + if (result[key]?.available === "no") { expect(result[key]?.reason).toBeDefined(); } }); diff --git a/tests/components/input/opensubsonic/integration.ts b/tests/components/input/opensubsonic/integration.ts index 283d36a5..4a8ce440 100644 --- a/tests/components/input/opensubsonic/integration.ts +++ b/tests/components/input/opensubsonic/integration.ts @@ -91,21 +91,21 @@ afterAll(async () => { }); describe("components/input/opensubsonic (integration)", () => { - it("consult returns true when the server pings ok", async () => { + it('consult returns "yes" when the server pings ok', async () => { const uri = `opensubsonic://user:pass@127.0.0.1:${port}?tls=f`; const result = await Worker.consult(uri); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(true); + expect(result.consult).toBe("yes"); } }); - it("consult returns false when the server is unreachable", async () => { + it('consult returns "no" when the server is unreachable', async () => { const uri = `opensubsonic://user:pass@127.0.0.1:${port + 9999}?tls=f`; const result = await Worker.consult(uri); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(false); + expect(result.consult).toBe("no"); } }); @@ -173,7 +173,7 @@ describe("components/input/opensubsonic (integration)", () => { const keys = Object.keys(result); expect(keys.length).toBe(1); const grouping = result[keys[0]]; - expect(grouping.available).toBe(true); + expect(grouping.available).toBe("yes"); expect(grouping.uris).toEqual([uri]); }); @@ -183,7 +183,7 @@ describe("components/input/opensubsonic (integration)", () => { const keys = Object.keys(result); expect(keys.length).toBe(1); const grouping = result[keys[0]]; - expect(grouping.available).toBe(false); + expect(grouping.available).toBe("no"); }); it("detach with scheme removes all opensubsonic tracks", async () => { diff --git a/tests/components/input/webdav/integration.ts b/tests/components/input/webdav/integration.ts index 02bc4877..466b25b9 100644 --- a/tests/components/input/webdav/integration.ts +++ b/tests/components/input/webdav/integration.ts @@ -72,7 +72,7 @@ afterAll(async () => { }); describe("components/input/webdav (integration)", () => { - it("consult returns true when the server responds with 207", async () => { + it('consult returns "yes" when the server responds with 207', async () => { const uri = buildURI( { username: "user", password: "pass", host: `127.0.0.1:${port}`, dir: "/" }, "", @@ -80,11 +80,11 @@ describe("components/input/webdav (integration)", () => { const result = await Worker.consult(uri); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(true); + expect(result.consult).toBe("yes"); } }); - it("consult returns false when the server is unreachable", async () => { + it('consult returns "no" when the server is unreachable', async () => { const uri = buildURI( { username: "user", password: "pass", host: `127.0.0.1:${port + 9999}`, dir: "/" }, "", @@ -92,7 +92,7 @@ describe("components/input/webdav (integration)", () => { const result = await Worker.consult(uri); expect(result.supported).toBe(true); if (result.supported) { - expect(result.consult).toBe(false); + expect(result.consult).toBe("no"); } }); @@ -149,7 +149,7 @@ describe("components/input/webdav (integration)", () => { const result = await Worker.groupConsult([uri]); const keys = Object.keys(result); expect(keys.length).toBe(1); - expect(result[keys[0]].available).toBe(true); + expect(result[keys[0]].available).toBe("yes"); }); it("groupConsult reports unavailable for an unreachable server", async () => { @@ -160,7 +160,7 @@ describe("components/input/webdav (integration)", () => { const result = await Worker.groupConsult([uri]); const keys = Object.keys(result); expect(keys.length).toBe(1); - expect(result[keys[0]].available).toBe(false); + expect(result[keys[0]].available).toBe("no"); }); it("detach with scheme removes all webdav tracks", async () => { -- 2.51.2