Skip to content

Build your personal knowledge base with Trilium Notes

test(llm): await async getModels in the chat route spec

Tomáš Adámek9ff1cb485c84
diff --git a/apps/server/src/routes/api/llm_chat.spec.ts b/apps/server/src/routes/api/llm_chat.spec.ts
index 2b6f84651f..e44370125e 100644
--- a/apps/server/src/routes/api/llm_chat.spec.ts
+++ b/apps/server/src/routes/api/llm_chat.spec.ts
@@ -80,14 +80,14 @@ describe("LLM chat API", () => {
});
describe("getModels", () => {
- it("returns no models when no provider is configured", () => {
+ it("returns no models when no provider is configured", async () => {
state.configured = false;
- expect(llmChatRoute.getModels({} as Request, {} as Response)).toEqual({ models: [] });
+ await expect(llmChatRoute.getModels({} as Request, {} as Response)).resolves.toEqual({ models: [] });
});
- it("returns all models when configured", () => {
+ it("returns all models when configured", async () => {
state.models = [{ id: "m1" }];
- expect(llmChatRoute.getModels({} as Request, {} as Response)).toEqual({ models: [{ id: "m1" }] });
+ await expect(llmChatRoute.getModels({} as Request, {} as Response)).resolves.toEqual({ models: [{ id: "m1" }] });
});
});