Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"@std/testing": "jsr:@std/testing@^1.0.16",
"@std/testing/bdd": "jsr:@std/testing@^1.0.16/bdd",
"@std/testing/mock": "jsr:@std/testing@^1.0.16/mock",
"@std/testing/snapshot": "jsr:@std/testing@^1.0.16/snapshot",
"@std/testing/time": "jsr:@std/testing@^1.0.16/time",
"@std/yaml": "jsr:@std/yaml@^1.0.10",
"@std/expect": "jsr:@std/expect@^1.0.17",
Expand Down
29 changes: 16 additions & 13 deletions packages/@binstruct/png/pngsuite/pngsuite.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import { createAssertSnapshot } from "@std/testing/snapshot";
import { pngFile } from "../mod.ts";
import { assertEquals, assertExists } from "@std/assert";
import { basename, join } from "node:path";

const assertSnapshot = createAssertSnapshot({
serializer: (value) =>
JSON.stringify(value, (_key, val) => {
// Simplify Uint8Array representation in snapshots
if (val instanceof Uint8Array) {
return `[Uint8Array length=${val.length} ${
Array.from(val).map((n) => n.toString(16).padStart(2, "0")).join("")
}]`;
}
return val;
}, 0),
});
function assertSnapshot(t: Deno.TestContext, value: unknown): Promise<void> {
return t.assertSnapshot(value, {
serializer: (value) =>
JSON.stringify(value, (_key, val) => {
// Simplify Uint8Array representation in snapshots
if (val instanceof Uint8Array) {
return `[Uint8Array length=${val.length} ${
Array.from(val).map((n) => n.toString(16).padStart(2, "0")).join(
"",
)
}]`;
}
return val;
}, 0),
});
}

const PNGSUITE_DIR = new URL(".", import.meta.url).pathname;

Expand Down
Loading