From 55cc1b7a3b0d2ae4c3d8c1da46a9c071f2b234ab Mon Sep 17 00:00:00 2001 From: Federico Jaramillo Martinez Date: Sat, 18 Jul 2026 21:18:53 +0200 Subject: [PATCH] test(auth): cover completion machine affinity Verify that an auth flow's terminal status refresh remains targeted at the flow's originating machine after the selected machine changes.\n\nRefs #74 --- src/client/src/controllers/authController.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/src/controllers/authController.test.ts b/src/client/src/controllers/authController.test.ts index b3ed3fa..8906f87 100644 --- a/src/client/src/controllers/authController.test.ts +++ b/src/client/src/controllers/authController.test.ts @@ -121,7 +121,11 @@ describe("AuthController", () => { const statusCalls: { session: Parameters[0]; machineId: string | undefined }[] = []; const appliedStatuses: SessionStatus[] = []; const { controller, getState } = createController( - { selectedSession: session, authDialog: { step: "oauth", flow, machineId: "local", inputValue: "https://callback" } }, + { + selectedMachine: remoteMachine("remote-2"), + selectedSession: session, + authDialog: { step: "oauth", flow, machineId: "remote-1", inputValue: "https://callback" }, + }, { respondOAuthFlow: (flowId, requestId, value, machineId) => { respondCalls.push({ flowId, requestId, value, machineId }); @@ -138,9 +142,9 @@ describe("AuthController", () => { await controller.respondOAuth(); await flushMicrotasks(); - expect(respondCalls).toEqual([{ flowId: "flow-1", requestId: "request-1", value: "https://callback", machineId: "local" }]); + expect(respondCalls).toEqual([{ flowId: "flow-1", requestId: "request-1", value: "https://callback", machineId: "remote-1" }]); expect(getState().authDialog).toBeUndefined(); - expect(statusCalls).toEqual([{ session, machineId: "local" }]); + expect(statusCalls).toEqual([{ session, machineId: "remote-1" }]); expect(appliedStatuses).toEqual([refreshedStatus]); });