From 2187f984349315fb3f574e702fc8dd726328c7bb Mon Sep 17 00:00:00 2001 From: Shakker Date: Fri, 8 May 2026 20:29:21 +0100 Subject: [PATCH] test: tighten qa credential fetch assertion --- .../qa-lab/src/qa-credentials-admin.runtime.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/extensions/qa-lab/src/qa-credentials-admin.runtime.test.ts b/extensions/qa-lab/src/qa-credentials-admin.runtime.test.ts index 8f13bd06303..7f0122ddd52 100644 --- a/extensions/qa-lab/src/qa-credentials-admin.runtime.test.ts +++ b/extensions/qa-lab/src/qa-credentials-admin.runtime.test.ts @@ -16,6 +16,15 @@ function jsonResponse(payload: unknown, status = 200) { }); } +function requireFirstFetchInput(fetchImpl: ReturnType): RequestInfo | URL { + const input = fetchImpl.mock.calls[0]?.[0] as RequestInfo | URL | undefined; + expect(input).toBeDefined(); + if (!input) { + throw new Error("expected fetch input"); + } + return input; +} + describe("qa credential admin runtime", () => { it("adds a credential set through the admin endpoint", async () => { const fetchImpl = vi.fn(async (_input: RequestInfo | URL, _init?: RequestInit) => @@ -112,7 +121,9 @@ describe("qa credential admin runtime", () => { fetchImpl, }); - expect(fetchImpl.mock.calls[0]?.[0]).toBe("http://127.0.0.1:3210/qa-credentials/v1/admin/list"); + expect(requireFirstFetchInput(fetchImpl)).toBe( + "http://127.0.0.1:3210/qa-credentials/v1/admin/list", + ); }); it("rejects unsafe endpoint-prefix overrides", async () => {