Skip to content

Commit 37936e1

Browse files
committed
test(search): check MCP account notes against the production status sentences
1 parent bdd0b19 commit 37936e1

2 files changed

Lines changed: 14 additions & 19 deletions

File tree

‎apps/sim/lib/knowledge/mcp/server.protocol.test.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ vi.mock('@/lib/api/server/routes/v2-json-route', () => ({
1717
...apiServerRoutesMock,
1818
v2RateLimits: { publicApi: { enforce: vi.fn().mockResolvedValue(null) } },
1919
}))
20-
vi.mock('@/lib/sim-search/live/application', () => ({
21-
LIVE_MORE_RANKED_BELOW_MESSAGE: 'More matches ranked below.',
22-
LIVE_DATE_ORDER_MESSAGE: 'Date order covers retrieved results.',
23-
LIVE_NOT_STARTED_MESSAGE: 'Not searched before the deadline.',
24-
LIVE_OVER_ACCOUNT_LIMIT_MESSAGE: 'Not searched: over the account limit.',
20+
vi.mock('@/lib/sim-search/live/application', async (importOriginal) => ({
21+
...(await importOriginal<typeof import('@/lib/sim-search/live/application')>()),
2522
searchLiveKnowledge: { execute: hoisted.liveSearch },
2623
readLiveDocument: { execute: hoisted.liveRead },
2724
}))

‎apps/sim/lib/knowledge/mcp/server.test.ts‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ const hoisted = vi.hoisted(() => ({
2121
rateLimit: vi.fn(),
2222
afterResponse: vi.fn<(task: () => Promise<void>) => void>(),
2323
recordActivity: vi.fn(),
24-
statusMessages: {
25-
LIVE_MORE_RANKED_BELOW_MESSAGE: 'More matches ranked below.',
26-
LIVE_DATE_ORDER_MESSAGE: 'Date order covers retrieved results.',
27-
LIVE_NOT_STARTED_MESSAGE: 'Not searched before the deadline.',
28-
LIVE_OVER_ACCOUNT_LIMIT_MESSAGE: 'Not searched: over the account limit.',
29-
},
3024
}))
3125
vi.mock('@/lib/core/utils/after-response', () => ({ afterResponse: hoisted.afterResponse }))
3226
vi.mock('@/lib/knowledge/mcp/activity', () => ({
@@ -51,8 +45,8 @@ vi.mock('@/lib/api/server/routes/v2-json-route', () => ({
5145
...apiServerRoutesMock,
5246
v2RateLimits: { publicApi: { enforce: hoisted.rateLimit } },
5347
}))
54-
vi.mock('@/lib/sim-search/live/application', () => ({
55-
...hoisted.statusMessages,
48+
vi.mock('@/lib/sim-search/live/application', async (importOriginal) => ({
49+
...(await importOriginal<typeof import('@/lib/sim-search/live/application')>()),
5650
searchLiveKnowledge: { execute: hoisted.liveSearch },
5751
readLiveDocument: { execute: hoisted.liveRead },
5852
}))
@@ -62,6 +56,12 @@ vi.mock('@/lib/knowledge/application/chat', () => ({
6256

6357
import { OrchestrationError } from '@/lib/core/orchestration/types'
6458
import { createKnowledgeMcpServer } from '@/lib/knowledge/mcp/server'
59+
import {
60+
LIVE_DATE_ORDER_MESSAGE,
61+
LIVE_MORE_RANKED_BELOW_MESSAGE,
62+
LIVE_NOT_STARTED_MESSAGE,
63+
LIVE_OVER_ACCOUNT_LIMIT_MESSAGE,
64+
} from '@/lib/sim-search/live/application'
6565
import type { ResolvedSecretTraceRegistry } from '@/executor/utils/resolved-secret-trace-registry'
6666

6767
const mocks = hoisted
@@ -235,12 +235,10 @@ describe('live organization Search MCP', () => {
235235

236236
it('states each repeated account status once and flags the entries that carried it', async () => {
237237
create()
238-
const {
239-
LIVE_MORE_RANKED_BELOW_MESSAGE: moreBelow,
240-
LIVE_DATE_ORDER_MESSAGE: dateOrder,
241-
LIVE_NOT_STARTED_MESSAGE: deadline,
242-
LIVE_OVER_ACCOUNT_LIMIT_MESSAGE: overLimit,
243-
} = mocks.statusMessages
238+
const moreBelow = LIVE_MORE_RANKED_BELOW_MESSAGE
239+
const dateOrder = LIVE_DATE_ORDER_MESSAGE
240+
const deadline = LIVE_NOT_STARTED_MESSAGE
241+
const overLimit = LIVE_OVER_ACCOUNT_LIMIT_MESSAGE
244242
const emptyPage = 'No readable matches on this page.'
245243
const unconnected = 'No connection with this provider is configured.'
246244
mocks.liveSearch.mockResolvedValueOnce({

0 commit comments

Comments
 (0)