Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -9,7 +9,7 @@ function decodeHeader(bytes: Uint8Array): string {
|
||||
return new TextDecoder().decode(bytes.slice(0, PDF_HEADER.length));
|
||||
}
|
||||
|
||||
describe("@toolctrl/exports/pdf public entrypoint", () => {
|
||||
describe("@hivegrid/exports/pdf public entrypoint", () => {
|
||||
it("exposes PDF helpers through the dedicated subpath", async () => {
|
||||
const exportsModule = await import("./index.js");
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { PassThrough } from "node:stream";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { serializeExportTableToPdfStream } from "./index.js";
|
||||
|
||||
async function collect(stream: PassThrough): Promise<Buffer> {
|
||||
const chunks: Buffer[] = [];
|
||||
for await (const chunk of stream) {
|
||||
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
||||
}
|
||||
return Buffer.concat(chunks);
|
||||
}
|
||||
|
||||
describe("serializeExportTableToPdfStream — title omitted", () => {
|
||||
it("renders a valid PDF without a title heading", async () => {
|
||||
const sink = new PassThrough();
|
||||
const collected = collect(sink);
|
||||
|
||||
// No `title` option -> the title <Text> node is skipped (null branch).
|
||||
const result = await serializeExportTableToPdfStream(sink, {
|
||||
columns: [{ key: "id", label: "Identifier" }],
|
||||
rows: [{ id: 1 }, { id: 2 }],
|
||||
});
|
||||
sink.end();
|
||||
|
||||
expect(result).toEqual({ rowCount: 2 });
|
||||
const buffer = await collected;
|
||||
expect(buffer.slice(0, 5).toString("utf8")).toBe("%PDF-");
|
||||
expect(buffer.byteLength).toBeGreaterThan(100);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user