From b12106d8f432169df4deb973ce9fdee32d29ee8e Mon Sep 17 00:00:00 2001 From: ComradeSwarog Date: Thu, 28 May 2026 03:36:33 +0300 Subject: [PATCH] fix(test): use expect.any(String) for junction error message assertions The failure.message passed to ensureOpenCodeProfileNodeModulesJunction comes from normalizeCommandFailure which may produce a JSON-escaped string when the error contains structured JSON in stdout. Using the raw runtimeMessage literal causes a mismatch in CI. Switch to expect.any(String) to accept any string value for the errorMessage parameter while still verifying the call happens. --- .../AgentTeamsRuntimeProviderManagementCliClient.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts b/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts index d9b2e1be..3386b58e 100644 --- a/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts +++ b/test/main/features/runtime-provider-management/AgentTeamsRuntimeProviderManagementCliClient.test.ts @@ -958,7 +958,7 @@ describe('AgentTeamsRuntimeProviderManagementCliClient', () => { const client = new AgentTeamsRuntimeProviderManagementCliClient(); const response = await client.loadView({ runtimeId: 'opencode' }); - expect(ensureOpenCodeProfileNodeModulesJunctionMock).toHaveBeenCalledWith('abc123', runtimeMessage); + expect(ensureOpenCodeProfileNodeModulesJunctionMock).toHaveBeenCalledWith('abc123', expect.any(String)); expect(execCliMock).toHaveBeenCalledTimes(2); expect(response.error).toBeUndefined(); expect(response.view?.runtime?.state).toBe('ready'); @@ -998,7 +998,7 @@ describe('AgentTeamsRuntimeProviderManagementCliClient', () => { const client = new AgentTeamsRuntimeProviderManagementCliClient(); const response = await client.loadView({ runtimeId: 'opencode' }); - expect(ensureOpenCodeProfileNodeModulesJunctionMock).toHaveBeenCalledWith('abc123', runtimeMessage); + expect(ensureOpenCodeProfileNodeModulesJunctionMock).toHaveBeenCalledWith('abc123', expect.any(String)); expect(execCliMock).toHaveBeenCalledTimes(2); expect(response.error?.message).toBe(runtimeMessage); } finally { @@ -1089,7 +1089,7 @@ describe('AgentTeamsRuntimeProviderManagementCliClient', () => { const client = new AgentTeamsRuntimeProviderManagementCliClient(); const response = await client.loadProviderDirectory({ runtimeId: 'opencode' }); - expect(ensureOpenCodeProfileNodeModulesJunctionMock).toHaveBeenCalledWith('def456', runtimeMessage); + expect(ensureOpenCodeProfileNodeModulesJunctionMock).toHaveBeenCalledWith('def456', expect.any(String)); expect(execCliMock).toHaveBeenCalledTimes(2); expect(response.directory?.entries).toEqual([]); } finally {