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
+15
-8
@@ -8,6 +8,11 @@ const runBulk = vi.fn();
|
||||
vi.mock("./_lib.js", () => ({
|
||||
runOutboxRequeueById: (...args: unknown[]) => runById(...args),
|
||||
runOutboxRequeueBulk: (...args: unknown[]) => runBulk(...args),
|
||||
normalizeTenantId: (value: unknown) => {
|
||||
const tenantId = typeof value === "string" ? value.trim() : "";
|
||||
if (!tenantId) throw new Error("--tenant must be a non-empty database identifier");
|
||||
return tenantId;
|
||||
},
|
||||
}));
|
||||
vi.mock("@hivegrid/db/client.server", () => ({
|
||||
getDbClient: () => ({ outboxEvent: {} }),
|
||||
@@ -59,10 +64,10 @@ describe("outbox requeue command wrapper", () => {
|
||||
it("delegates single-event mode and adopts the lib outcome exit code", async () => {
|
||||
runById.mockResolvedValueOnce({ exitCode: 0 });
|
||||
|
||||
await outboxRequeueCommand.run?.({ args: { "event-id": "evt-1" } } as never);
|
||||
await outboxRequeueCommand.run?.({ args: { tenant: "tenant-1", "event-id": "evt-1" } } as never);
|
||||
|
||||
expect(runById).toHaveBeenCalledWith(
|
||||
{ eventId: "evt-1", json: false },
|
||||
{ tenantId: "tenant-1", eventId: "evt-1", json: false },
|
||||
expect.objectContaining({ client: expect.anything(), output: expect.anything() }),
|
||||
);
|
||||
expect(runBulk).not.toHaveBeenCalled();
|
||||
@@ -75,6 +80,7 @@ describe("outbox requeue command wrapper", () => {
|
||||
await outboxRequeueCommand.run?.({
|
||||
args: {
|
||||
type: "billing.subscription.ended",
|
||||
tenant: "tenant-1",
|
||||
since: "2026-05-01T00:00:00Z",
|
||||
apply: true,
|
||||
"include-done": true,
|
||||
@@ -84,6 +90,7 @@ describe("outbox requeue command wrapper", () => {
|
||||
|
||||
expect(runBulk).toHaveBeenCalledWith(
|
||||
{
|
||||
tenantId: "tenant-1",
|
||||
type: "billing.subscription.ended",
|
||||
since: "2026-05-01T00:00:00Z",
|
||||
apply: true,
|
||||
@@ -98,12 +105,12 @@ describe("outbox requeue command wrapper", () => {
|
||||
|
||||
it("omits limit from the bulk payload when not parseable", async () => {
|
||||
await outboxRequeueCommand.run?.({
|
||||
args: { type: "a.b.c", since: "2026-05-01T00:00:00Z", limit: "not-a-number" },
|
||||
args: { tenant: "tenant-1", type: "a.b.c", since: "2026-05-01T00:00:00Z", limit: "not-a-number" },
|
||||
} as never);
|
||||
|
||||
const payload = runBulk.mock.calls[0]?.[0] as Record<string, unknown>;
|
||||
expect(payload).not.toHaveProperty("limit");
|
||||
expect(payload).toMatchObject({ apply: false, includeDone: false, json: false });
|
||||
expect(payload).toMatchObject({ tenantId: "tenant-1", apply: false, includeDone: false, json: false });
|
||||
});
|
||||
|
||||
it("routes the lib output sink through consola (text mode)", async () => {
|
||||
@@ -115,7 +122,7 @@ describe("outbox requeue command wrapper", () => {
|
||||
return { exitCode: 0 };
|
||||
});
|
||||
|
||||
await outboxRequeueCommand.run?.({ args: { "event-id": "evt-1" } } as never);
|
||||
await outboxRequeueCommand.run?.({ args: { tenant: "tenant-1", "event-id": "evt-1" } } as never);
|
||||
|
||||
expect(consoleMock.success).toHaveBeenCalledWith("done");
|
||||
expect(consoleMock.warn).toHaveBeenCalledWith("careful");
|
||||
@@ -131,7 +138,7 @@ describe("outbox requeue command wrapper", () => {
|
||||
return { exitCode: 0 };
|
||||
});
|
||||
|
||||
await outboxRequeueCommand.run?.({ args: { "event-id": "evt-1", json: true } } as never);
|
||||
await outboxRequeueCommand.run?.({ args: { tenant: "tenant-1", "event-id": "evt-1", json: true } } as never);
|
||||
|
||||
expect(consoleMock.success).not.toHaveBeenCalled();
|
||||
expect(consoleMock.error).not.toHaveBeenCalled();
|
||||
@@ -141,7 +148,7 @@ describe("outbox requeue command wrapper", () => {
|
||||
it("catches lib exceptions and reports a human error in text mode", async () => {
|
||||
runById.mockRejectedValueOnce(new Error("db down"));
|
||||
|
||||
await outboxRequeueCommand.run?.({ args: { "event-id": "evt-1" } } as never);
|
||||
await outboxRequeueCommand.run?.({ args: { tenant: "tenant-1", "event-id": "evt-1" } } as never);
|
||||
|
||||
expect(consoleMock.error).toHaveBeenCalledWith("outbox requeue failed: db down");
|
||||
expect(process.exitCode).toBe(1);
|
||||
@@ -151,7 +158,7 @@ describe("outbox requeue command wrapper", () => {
|
||||
runBulk.mockRejectedValueOnce("boom");
|
||||
|
||||
await outboxRequeueCommand.run?.({
|
||||
args: { type: "a.b.c", since: "2026-05-01T00:00:00Z", json: true },
|
||||
args: { tenant: "tenant-1", type: "a.b.c", since: "2026-05-01T00:00:00Z", json: true },
|
||||
} as never);
|
||||
|
||||
expect(consoleMock.log).toHaveBeenCalledWith(
|
||||
|
||||
Reference in new issue
Block a user