implemented SlopStore and tested

This commit is contained in:
Jack Case
2026-01-07 21:22:43 +00:00
parent e01b00eab7
commit 41d4a0cd8f
2 changed files with 37 additions and 6 deletions

View File

@@ -153,7 +153,26 @@ describe("SlopStore", () => {
db.close()
})
it("passes", () => {
expect(true).toBeTrue()
it("stores slop", async () => {
const stored = await slopdb.slop_store.store("its-slop.slop", "some/slop")
expect(stored).toBe("its-slop.slop")
const retrieved = await slopdb.slop_store.get(new URL("http://its-slop.slop/some/slop"))
const expected_set = new Set()
expected_set.add("some/slop")
expect(retrieved).toEqual({domain: "its-slop.slop", paths: expected_set})
})
it("stores new slop paths to existing domains", async () => {
const stored = await slopdb.slop_store.store("its-slop.slop", "some/slop")
const new_path = await slopdb.slop_store.store("its-slop.slop", "some/other/slop")
expect(new_path).toBe("its-slop.slop")
const expected_set = new Set()
expected_set.add("some/slop")
expected_set.add("some/other/slop")
const retrieved = await slopdb.slop_store.get(new URL("http://its-slop.slop/some/slop"))
expect(retrieved).toEqual({domain: "its-slop.slop", paths: expected_set})
})
})