From 2ed2fbb55dd7e9d01f09590df0c77f1ba5f5e415 Mon Sep 17 00:00:00 2001 From: Shakker Date: Tue, 12 May 2026 21:57:49 +0100 Subject: [PATCH] test: service gateway doctor notes --- src/commands/doctor-gateway-services.test.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/commands/doctor-gateway-services.test.ts b/src/commands/doctor-gateway-services.test.ts index 720de7201a9..1511fdbfc3c 100644 --- a/src/commands/doctor-gateway-services.test.ts +++ b/src/commands/doctor-gateway-services.test.ts @@ -246,25 +246,25 @@ function expectCallConfigGatewayAuthToken( mock: { mock: { calls: Array> } }, expected: string, ) { - const matched = mock.mock.calls.some(([value]) => { + const matchingCalls = mock.mock.calls.filter(([value]) => { const options = value && typeof value === "object" ? (value as Record) : {}; return readGatewayAuthToken(options.config) === expected; }); - expect(matched).toBe(true); + expect(matchingCalls).not.toEqual([]); } function expectNoteContaining(messagePart: string, title: string) { const messages = mocks.note.mock.calls .filter(([, callTitle]) => callTitle === title) .map(([message]) => String(message)); - expect(messages.some((message) => message.includes(messagePart))).toBe(true); + expect(messages.join("\n")).toContain(messagePart); } function expectNoNoteContaining(messagePart: string, title: string) { const messages = mocks.note.mock.calls .filter(([, callTitle]) => callTitle === title) .map(([message]) => String(message)); - expect(messages.some((message) => message.includes(messagePart))).toBe(false); + expect(messages.join("\n")).not.toContain(messagePart); } function setupGatewayEntrypointRepairScenario(params: { @@ -402,12 +402,10 @@ describe("maybeRepairGatewayServiceConfig", () => { const runtimeNotes = mocks.note.mock.calls.filter(([, title]) => title === "Gateway runtime"); const runtimeMessages = runtimeNotes.map(([message]) => message); expect(runtimeMessages).not.toContain("duplicate doctor runtime warning"); - expect(runtimeMessages.some((message) => String(message).includes("not found"))).toBe(false); - expect( - runtimeMessages.some((message) => - String(message).includes("Using /home/orin/.nvm/versions/node/v22.22.2/bin/node"), - ), - ).toBe(true); + expect(runtimeMessages.map((message) => String(message)).join("\n")).not.toContain("not found"); + expect(runtimeMessages.map((message) => String(message)).join("\n")).toContain( + "Using /home/orin/.nvm/versions/node/v22.22.2/bin/node", + ); }); it("passes planned managed env keys into service audit for legacy inline secret detection", async () => {