mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-11-02 22:38:18 +00:00
Run binary round-trip coverage with the Node CLI runner
This commit is contained in:
1 parent
68dcc7eb94
commit
6d92f19dd9
1 file changed
+5
-5
@@ -73,19 +73,19 @@ test("CLI file operations: push / cat / ls / info / rm / resolve / cat-rev / pul
|
|||||||
console.log("[PASS] push/cat roundtrip matched");
|
console.log("[PASS] push/cat roundtrip matched");
|
||||||
});
|
});
|
||||||
|
|
||||||
await t.step("push/pull binary roundtrip", async () => {
|
await t.test("push/pull binary roundtrip", async () => {
|
||||||
const source = workDir.join("binary-source.bin");
|
const source = workDir.join("binary-source.bin");
|
||||||
const restored = workDir.join("binary-restored.bin");
|
const restored = workDir.join("binary-restored.bin");
|
||||||
const remotePath = "test/blob-roundtrip.bin";
|
const remotePath = "test/blob-roundtrip.bin";
|
||||||
const content = Uint8Array.from({ length: 1025 }, (_, index) => index % 256);
|
const content = Uint8Array.from({ length: 1025 }, (_, index) => index % 256);
|
||||||
await Deno.writeFile(source, content);
|
await writeFile(source, content);
|
||||||
|
|
||||||
await run("push", source, remotePath);
|
await run("push", source, remotePath);
|
||||||
await run("pull", remotePath, restored);
|
await run("pull", remotePath, restored);
|
||||||
|
|
||||||
assertEquals(await Deno.readFile(restored), content, "Binary push/pull must preserve every byte");
|
assert.deepStrictEqual(new Uint8Array(await readFile(restored)), content, "Binary push/pull must preserve every byte");
|
||||||
const info = JSON.parse(await run("info", remotePath));
|
const info = JSON.parse(await run("info", remotePath)) as Record<string, unknown>;
|
||||||
assertEquals(info.size, content.byteLength, "Binary Metadata must retain the original byte length");
|
assert.deepStrictEqual(info.size, content.byteLength, "Binary Metadata must retain the original byte length");
|
||||||
});
|
});
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|||||||
Reference in new issue
Block a user