Skip to content

Commit 70506f0

Browse files
author
deepak-rawat
committed
fix(tests): add missing mocks for getDefaultRemote and loadRepoConfig
The orchestrator test mocked @archon/git without getDefaultRemote and ../config/config-loader without loadRepoConfig, causing CI failures. Also update syncWorkspace assertions to use objectContaining so they don't break when additional options (like remote) are passed.
1 parent a0e07c4 commit 70506f0

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

packages/core/src/orchestrator/orchestrator-agent.test.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ mock.module('../db/workflow-events', () => ({
159159

160160
mock.module('../config/config-loader', () => ({
161161
loadConfig: mockLoadConfig,
162+
loadRepoConfig: mock(() => Promise.resolve({})),
162163
}));
163164

164165
mock.module('../services/title-generator', () => ({
@@ -203,6 +204,7 @@ mock.module('../utils/worktree-sync', () => ({
203204
}));
204205

205206
mock.module('@archon/git', () => ({
207+
getDefaultRemote: mock(() => Promise.resolve('origin')),
206208
syncWorkspace: mockSyncWorkspace,
207209
toRepoPath: mockToRepoPath,
208210
}));
@@ -985,9 +987,11 @@ describe('discoverAllWorkflows — remote sync', () => {
985987
await handleMessage(platform, 'conv-1', 'What is the latest commit?');
986988

987989
// /repos/test-repo is NOT under ~/.archon/workspaces/ so resetAfterFetch=false
988-
expect(mockSyncWorkspace).toHaveBeenCalledWith('/repos/test-repo', undefined, {
989-
resetAfterFetch: false,
990-
});
990+
expect(mockSyncWorkspace).toHaveBeenCalledWith(
991+
'/repos/test-repo',
992+
undefined,
993+
expect.objectContaining({ resetAfterFetch: false })
994+
);
991995
// Regression guard: orchestrator must resolve cwd through the ensure variant
992996
// so the workspaces dir is created before the AI provider spawn (issue #1528).
993997
expect(mockEnsureArchonWorkspacesPath).toHaveBeenCalled();
@@ -1008,7 +1012,7 @@ describe('discoverAllWorkflows — remote sync', () => {
10081012
expect(mockSyncWorkspace).toHaveBeenCalledWith(
10091013
'/home/test/.archon/workspaces/owner/repo/source',
10101014
undefined,
1011-
{ resetAfterFetch: true }
1015+
expect.objectContaining({ resetAfterFetch: true })
10121016
);
10131017
});
10141018

@@ -1024,9 +1028,11 @@ describe('discoverAllWorkflows — remote sync', () => {
10241028
await expect(
10251029
handleMessage(platform, 'conv-1', 'What is the latest commit?')
10261030
).resolves.toBeUndefined();
1027-
expect(mockSyncWorkspace).toHaveBeenCalledWith('/repos/test-repo', undefined, {
1028-
resetAfterFetch: false,
1029-
});
1031+
expect(mockSyncWorkspace).toHaveBeenCalledWith(
1032+
'/repos/test-repo',
1033+
undefined,
1034+
expect.objectContaining({ resetAfterFetch: false })
1035+
);
10301036
});
10311037

10321038
test('does not call syncWorkspace when conversation has no codebase_id', async () => {

0 commit comments

Comments
 (0)