silverbullet/common/spaces/chunked_datastore_space_pri...

19 lines
795 B
TypeScript
Raw Normal View History

import { MemoryKvPrimitives } from "$lib/data/memory_kv_primitives.ts";
2024-07-30 23:24:17 +08:00
import { assertEquals } from "@std/assert";
import { ChunkedKvStoreSpacePrimitives } from "./chunked_datastore_space_primitives.ts";
import { testSpacePrimitives } from "./space_primitives.test.ts";
Deno.test("chunked_datastore_space_primitives", async () => {
const memoryKv = new MemoryKvPrimitives();
// In memory store and tiny chunks for testing
const spacePrimitives = new ChunkedKvStoreSpacePrimitives(memoryKv, 5);
await testSpacePrimitives(spacePrimitives);
const [deletedChunk] = await memoryKv.batchGet([[
"content",
"test.bin",
"000",
]]);
// This one was deleted during the test (but here we're checking the underlying store for content)
assertEquals(deletedChunk, undefined);
});