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
@@ -0,0 +1,35 @@
|
||||
import { OUTBOX_MAX_PAYLOAD_BYTES } from "@hivegrid/db/outbox";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { generateDemoProSeed } from "./generator";
|
||||
import { generateOperationalGraph } from "./operations";
|
||||
import { splitSearchPayload } from "./search-batches";
|
||||
|
||||
describe("demo-pro search outbox batches", () => {
|
||||
it("keeps the largest generated task payloads below the outbox hard limit", () => {
|
||||
const graph = generateDemoProSeed();
|
||||
const operational = generateOperationalGraph(graph);
|
||||
const tenantId = "tenant-demo-pro";
|
||||
const documents = operational.tasks.map((task) => ({
|
||||
id: task.id,
|
||||
tenantId,
|
||||
title: task.title,
|
||||
description: task.description,
|
||||
status: task.status,
|
||||
priority: task.priority,
|
||||
linkedEntityId: task.projectId,
|
||||
deadline: task.deadline,
|
||||
}));
|
||||
const payloadFor = (batch: readonly (typeof documents)[number][]) => ({
|
||||
action: "upsert-batch",
|
||||
indexName: "tasks",
|
||||
tenantId,
|
||||
documents: batch,
|
||||
});
|
||||
const batches = splitSearchPayload(documents, payloadFor);
|
||||
|
||||
expect(batches.flat()).toEqual(documents);
|
||||
expect(batches.length).toBeLessThan(20);
|
||||
expect(batches.every((batch) => Buffer.byteLength(JSON.stringify(payloadFor(batch)), "utf8") < OUTBOX_MAX_PAYLOAD_BYTES)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user