Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -0,0 +1,62 @@
import { describe, expect, it, vi } from "vitest";
import { queueNames, type TypedQueue } from "@hivegrid/queue";
import { GDPR_USER_SELF_EXPORT_TYPE, enqueueGdprExport } from "./gdprExportQueue.server";
function createQueueMock(jobId = "queued-job"): TypedQueue<typeof queueNames.exports> & { add: ReturnType<typeof vi.fn>; close: ReturnType<typeof vi.fn> } {
return {
add: vi.fn(async () => ({ id: jobId })),
close: vi.fn(async () => undefined),
} as unknown as TypedQueue<typeof queueNames.exports> & { add: ReturnType<typeof vi.fn>; close: ReturnType<typeof vi.fn> };
}
describe("enqueueGdprExport", () => {
it("enqueues a GDPR self-export on the shared export queue", async () => {
const queue = createQueueMock("bullmq_job_1");
await expect(
enqueueGdprExport(
{
exportJobId: "gdpr_export_1",
tenantId: "tenant_1",
requestedByUserId: "user_1",
scope: "user_self",
targetUserId: "user_1",
requestId: "req_1",
},
{ queue },
),
).resolves.toEqual({ enqueued: true, jobId: "bullmq_job_1" });
expect(queue.add).toHaveBeenCalledWith(
"run-export",
expect.objectContaining({
kind: "export.run",
exportJobId: "gdpr_export_1",
tenantId: "tenant_1",
requestedByUserId: "user_1",
exportType: GDPR_USER_SELF_EXPORT_TYPE,
format: "json",
requestId: "req_1",
metadata: { scope: "user_self", targetUserId: "user_1" },
}),
expect.objectContaining({ jobId: "gdpr_export_1" }),
);
expect(queue.close).not.toHaveBeenCalled();
});
it("returns queue-unavailable when no queue or Redis connection is configured", async () => {
await expect(
enqueueGdprExport(
{
exportJobId: "gdpr_export_1",
tenantId: "tenant_1",
requestedByUserId: "user_1",
scope: "user_self",
},
{ env: {} },
),
).resolves.toEqual({ enqueued: false, reason: "queue-unavailable" });
});
});