mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-19 07:42:43 +00:00
add test
This commit is contained in:
parent
5612380dc2
commit
4365fbd2a2
1 changed files with 24 additions and 0 deletions
|
|
@ -521,5 +521,29 @@ describe("withSupermemory / wrapVercelLanguageModel", () => {
|
|||
containerTags: [customTag],
|
||||
})
|
||||
})
|
||||
|
||||
it("should not mutate the original params.prompt array", async () => {
|
||||
mockSupermemory.search.execute.mockResolvedValue(
|
||||
createMockSearchResponse([]),
|
||||
)
|
||||
|
||||
const middleware = createSupermemoryMiddleware(
|
||||
mockSupermemory,
|
||||
TEST_CONFIG.containerTag,
|
||||
)
|
||||
|
||||
const originalPrompt = [
|
||||
{ role: "user" as const, content: [{ type: "text" as const, text: "First" }] },
|
||||
{ role: "user" as const, content: [{ type: "text" as const, text: "Last" }] }
|
||||
]
|
||||
const params: LanguageModelV2CallOptions = { prompt: [...originalPrompt] }
|
||||
|
||||
await callTransformParams(middleware, params)
|
||||
|
||||
// Verify order is unchanged
|
||||
expect(params.prompt[0]?.content[0]).toBe("First")
|
||||
expect(params.prompt[1]?.content[0]).toBe("Last")
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue