implemented SlopStore and tested
This commit is contained in:
@@ -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})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user