Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+35
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
const mocks = vi.hoisted(() => ({ loadContext: vi.fn(), loadSuggestions: vi.fn() }));
|
||||
vi.mock("~/modules/chat/routes/chatAccess.server", () => ({ loadChatContext: mocks.loadContext }));
|
||||
vi.mock("~/modules/chat/services/ChatMentionsService.server", () => ({ loadChatMentionSuggestions: mocks.loadSuggestions }));
|
||||
|
||||
import { loader } from "./chat.$id.mentions";
|
||||
|
||||
describe("chat mention resource route", () => {
|
||||
it("normalizes the requested kind and returns the server-built VM", async () => {
|
||||
const context = { tenantId: "tenant_1", userId: "user_1", permissions: [], hasModule: true };
|
||||
mocks.loadContext.mockResolvedValue(context);
|
||||
mocks.loadSuggestions.mockResolvedValue({ groups: [], total: 0 });
|
||||
|
||||
const response = await loader({
|
||||
request: new Request("https://app.test/acme/chat/chat_1/mentions?q=anna&type=contact"),
|
||||
params: { tenant: "acme", id: "chat_1" },
|
||||
context: {},
|
||||
} as never);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(mocks.loadSuggestions).toHaveBeenCalledWith({ context, tenantSlug: "acme", chatId: "chat_1", query: "anna", type: "contact" });
|
||||
});
|
||||
|
||||
it("does not pass an unsupported kind into the repository", async () => {
|
||||
mocks.loadContext.mockResolvedValue({ tenantId: "tenant_1", userId: "user_1", permissions: [], hasModule: true });
|
||||
mocks.loadSuggestions.mockResolvedValue({ groups: [], total: 0 });
|
||||
await loader({
|
||||
request: new Request("https://app.test/acme/chat/chat_1/mentions?type=deal"),
|
||||
params: { tenant: "acme", id: "chat_1" },
|
||||
context: {},
|
||||
} as never);
|
||||
expect(mocks.loadSuggestions).toHaveBeenLastCalledWith(expect.objectContaining({ type: null }));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user