@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { findRoutes, properties } from "../../src/lab/catalog";
|
||||
import { parseData, runRoundTrip, serializeData } from "../../src/lab/data";
|
||||
import { parseEvidence, serializeEvidence } from "../../src/lab/evidence";
|
||||
|
||||
const all = properties.data.map((property) => property.id);
|
||||
const sample = JSON.stringify([
|
||||
@@ -29,6 +30,13 @@ describe("structured data lab", () => {
|
||||
property: "metadata",
|
||||
status: "not-tested",
|
||||
});
|
||||
expect(parseEvidence(serializeEvidence(result.evidence))).toEqual(
|
||||
result.evidence,
|
||||
);
|
||||
expect(result.evidence).toMatchObject({
|
||||
contractVersion: 1,
|
||||
provenance: { execution: "local-browser", networkRequired: false },
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes CSV type, null and nested-value changes", () => {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { exportCorpusFiles } from "../../src/lab/corpus";
|
||||
import {
|
||||
formatSignatures,
|
||||
identifyBySignature,
|
||||
} from "../../src/lab/signatures";
|
||||
|
||||
describe("format signatures and corpus", () => {
|
||||
it("distinguishes masked RIFF forms and container-only evidence", () => {
|
||||
const wav = Uint8Array.of(
|
||||
0x52,
|
||||
0x49,
|
||||
0x46,
|
||||
0x46,
|
||||
0x24,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x57,
|
||||
0x41,
|
||||
0x56,
|
||||
0x45,
|
||||
);
|
||||
expect(identifyBySignature(wav).map((item) => item.format)).toContain(
|
||||
"wav",
|
||||
);
|
||||
expect(identifyBySignature(wav).map((item) => item.format)).not.toContain(
|
||||
"webp",
|
||||
);
|
||||
expect(
|
||||
identifyBySignature(Uint8Array.of(0x50, 0x4b, 0x03, 0x04))[0],
|
||||
).toMatchObject({ format: "zip", confidence: "container" });
|
||||
});
|
||||
|
||||
it("ships a broad, deterministic structured regression corpus", () => {
|
||||
expect(formatSignatures.length).toBeGreaterThanOrEqual(20);
|
||||
const first = exportCorpusFiles();
|
||||
expect(first).toEqual(exportCorpusFiles());
|
||||
expect(first.map((file) => file.path)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"structured/typed.json",
|
||||
"structured/text-cells.csv",
|
||||
"corpus-manifest.json",
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user