Skip to content

Commit 688c738

Browse files
test(mothership): clear handler registry between executor tests
Add clearHandlers() helper and reset the module-level handler registry in beforeEach so handlers registered in one test do not leak into the next.
1 parent 452de03 commit 688c738

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

apps/sim/lib/copilot/tool-executor/executor.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ vi.mock('@/tools', () => ({
2525
executeTool: executeAppTool,
2626
}))
2727

28-
import { executeTool, registerHandler } from './executor'
28+
import { clearHandlers, executeTool, registerHandler } from './executor'
2929

3030
describe('copilot tool executor fallback', () => {
3131
beforeEach(() => {
3232
vi.clearAllMocks()
33+
clearHandlers()
3334
})
3435

3536
it('falls back to app tool executor for dynamic sim tools', async () => {

apps/sim/lib/copilot/tool-executor/executor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export function hasHandler(toolId: string): boolean {
3535
return handlerRegistry.has(toolId)
3636
}
3737

38+
export function clearHandlers(): void {
39+
handlerRegistry.clear()
40+
}
41+
3842
export async function executeTool(
3943
toolId: string,
4044
params: Record<string, unknown>,

0 commit comments

Comments
 (0)