Skip to content

Commit f1c9d34

Browse files
test(mcp): align mocks with scoped execution
1 parent 6953d4d commit f1c9d34

5 files changed

Lines changed: 7 additions & 2 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createRoot, type Root } from 'react-dom/client'
77
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
88

99
vi.mock('@/hooks/queries/skills', () => ({ useSkills: () => ({ data: [] }) }))
10-
vi.mock('@/hooks/queries/mcp', () => ({ useMcpServers: () => ({ data: [] }) }))
10+
vi.mock('@/hooks/queries/mcp', () => ({ useMcpToolServers: () => ({ data: [] }) }))
1111
vi.mock('@/blocks/integration-matcher', () => ({
1212
getIntegrationMatcher: () => ({ regex: null, byName: new Map() }),
1313
}))

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createRoot, type Root } from 'react-dom/client'
66
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
77

88
vi.mock('@/hooks/queries/skills', () => ({ useSkills: () => ({ data: [] }) }))
9-
vi.mock('@/hooks/queries/mcp', () => ({ useMcpServers: () => ({ data: [] }) }))
9+
vi.mock('@/hooks/queries/mcp', () => ({ useMcpToolServers: () => ({ data: [] }) }))
1010
vi.mock('@/blocks/integration-matcher', () => ({
1111
getIntegrationMatcher: () => ({ regex: null, byName: new Map() }),
1212
}))

apps/sim/lib/credential-groups/mcp-oauth-state.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ const { mockRedis, values } = vi.hoisted(() => {
1818
values.delete(key)
1919
return value
2020
}),
21+
sadd: vi.fn(async () => 1),
22+
srem: vi.fn(async () => 1),
23+
pexpire: vi.fn(async () => 1),
2124
},
2225
}
2326
})

apps/sim/lib/credentials/application/credential-crud.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ vi.mock('@/lib/credentials/queries', () => ({
3737
vi.mock('@/lib/credentials/access', () => ({
3838
getCredentialActorContext: mocks.getActor,
3939
canUseCredential: () => true,
40+
requireOrdinaryCredentialType: (type: string) => type,
4041
}))
4142
vi.mock('@/lib/credentials/orchestration', () => ({
4243
updateCredentialRecord: mocks.updateRecord,

apps/sim/lib/internal/mcp/execute-tool.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ describe('executeMcpTool', () => {
9393
expect(mocks.createPrincipal).toHaveBeenCalledWith({
9494
context: CONTEXT,
9595
audience: 'sim:mcp-servers',
96+
resourceScope: { mcpServerId: 'mcp-server' },
9697
})
9798
expect(mocks.executeUseCase).toHaveBeenCalledWith({
9899
principal: PRINCIPAL,

0 commit comments

Comments
 (0)