fix(test): add missing teammate exports to hookChains integration mock (#840)

mock.module('./teammate.js', ...) only declared getAgentName/getTeamName/
getTeammateColor. Bun applies module mocks process-globally and
mock.restore() does not undo them, so whenever another test file ran
after hookChains.integration.test.ts and reached the real teammate
module it received undefined for isTeammate/isPlanModeRequired/
getAgentId/getParentSessionId.

This surfaced in CI as intermittent failures in
src/commands/provider/provider.test.tsx (TextEntryDialog / wizard
remount / ProviderWizard hides Codex OAuth), because getDefaultAppState
in AppStateStore.ts calls teammateUtils.isTeammate().

Match the mock surface to the real teammate.ts exports so downstream
consumers keep working even after the integration test pollutes the
module cache. Keeps the same behavioral overrides this test needed.

Closes #839
This commit is contained in:
0xfandom
2026-04-22 23:06:42 +05:30
committed by GitHub
parent 531e3f1059
commit 23e8cfbd5b

View File

@@ -75,6 +75,13 @@ async function importHookChainsHarness(
getAgentName: () => senderName,
getTeamName: () => teamName,
getTeammateColor: () => 'blue',
// Keep parity with the real module's surface so later tests that
// run after this file (mock.module is process-global and mock.restore
// does not undo module mocks in Bun) do not see undefined members.
isTeammate: () => false,
isPlanModeRequired: () => false,
getAgentId: () => undefined,
getParentSessionId: () => undefined,
}))
mock.module('../bridge/replBridgeHandle.js', () => ({