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
+31
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
const mocks = vi.hoisted(() => ({ audit: vi.fn(), activity: vi.fn() }));
|
||||
vi.mock("@hivegrid/db/audit-events.server", () => ({ publishAuditEventViaOutbox: mocks.audit }));
|
||||
vi.mock("./mentions.server.js", () => ({ logChatMessageActivitiesWithTx: mocks.activity }));
|
||||
|
||||
import { publishTopLevelChatMessageEffectsWithTx } from "./message-effects.server.js";
|
||||
|
||||
describe("publishTopLevelChatMessageEffectsWithTx", () => {
|
||||
it("publishes one audit record and delegates project/entity activities in the same transaction", async () => {
|
||||
const tx = {};
|
||||
const context = { tenantId: "tenant_1", userId: "user_1", permissions: ["chat.write"] } as const;
|
||||
mocks.audit.mockResolvedValue(undefined);
|
||||
mocks.activity.mockResolvedValue(undefined);
|
||||
|
||||
await publishTopLevelChatMessageEffectsWithTx(tx as never, context, {
|
||||
channel: { id: "chat_1", kind: "project", isPrivate: true, projektId: "project_1", name: "P-100" },
|
||||
messageId: "message_1",
|
||||
requestId: "request_1",
|
||||
body: "Hallo <@contact:contact_1>",
|
||||
mentions: [{ type: "contact", id: "contact_1", label: "Anna" }],
|
||||
});
|
||||
|
||||
expect(mocks.audit).toHaveBeenCalledWith(tx, expect.objectContaining({ action: "chat.message.created", requestId: "request_1" }));
|
||||
expect(mocks.activity).toHaveBeenCalledWith(
|
||||
tx,
|
||||
context,
|
||||
expect.objectContaining({ includeProjectChannelActivity: true, action: "message_created" })
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user