You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
import { describe, expect, test } from "bun:test";
|
|
import { buildExportManifest } from "./build-manifest";
|
|
|
|
describe("buildExportManifest", () => {
|
|
test("builds manifest with required fields and checksums", () => {
|
|
const exportedAt = new Date("2026-04-24T10:00:00.000Z");
|
|
const cutoffAt = new Date("2026-04-24T09:00:00.000Z");
|
|
|
|
const manifest = buildExportManifest({
|
|
schemaVersion: 1,
|
|
userId: 123,
|
|
maskPolicy: "masked",
|
|
exportedAt,
|
|
exportCutoffAt: cutoffAt,
|
|
stats: {
|
|
dataRows: 10,
|
|
files: 1,
|
|
bytes: 1024,
|
|
},
|
|
dataChecksums: [
|
|
{ file: "data/user.json", sha256: "sha256-user" },
|
|
{ file: "data/media-assets.json", sha256: "sha256-media" },
|
|
],
|
|
fileChecksums: [{ file: "files/a.webp", sha256: "sha256-file-a" }],
|
|
});
|
|
|
|
expect(manifest).toEqual({
|
|
schemaVersion: 1,
|
|
exportedAt: exportedAt.toISOString(),
|
|
exportCutoffAt: cutoffAt.toISOString(),
|
|
userId: 123,
|
|
maskPolicy: "masked",
|
|
stats: {
|
|
dataRows: 10,
|
|
files: 1,
|
|
bytes: 1024,
|
|
},
|
|
checksums: {
|
|
data: [
|
|
{ file: "data/user.json", sha256: "sha256-user" },
|
|
{ file: "data/media-assets.json", sha256: "sha256-media" },
|
|
],
|
|
files: [{ file: "files/a.webp", sha256: "sha256-file-a" }],
|
|
},
|
|
});
|
|
});
|
|
});
|
|
|