nest describes for version 1/version 2 DB

This commit is contained in:
Jack Case
2025-12-11 16:12:41 +00:00
parent fbb11c86cc
commit 1b0f7e7704

View File

@@ -19,27 +19,33 @@ describe("SlopDB", () => {
db.close() db.close()
}) })
it("creates a version 1 indexeddb", async () => { describe("version 1", () => {
const slopdb_v1 = new SlopDB(1) it("creates a version 1 indexeddb", async () => {
await slopdb_v1.db_opened() const slopdb_v1 = new SlopDB(1)
db = slopdb_v1.db await slopdb_v1.db_opened()
db = slopdb_v1.db
const object_stores = slopdb_v1.db.objectStoreNames const object_stores = slopdb_v1.db.objectStoreNames
expect(object_stores).toContain("slop") expect(object_stores).toContain("slop")
expect(object_stores).not.toContain("checkcache") expect(object_stores).not.toContain("checkcache")
// slopdb_v1.db.close() // slopdb_v1.db.close()
})
}) })
it("creates a version 2 indexeddb", async () => { describe("version 2", () => {
const slopdb_v2 = new SlopDB(2) it("creates a version 2 indexeddb", async () => {
await slopdb_v2.db_opened() const slopdb_v2 = new SlopDB(2)
db = slopdb_v2.db await slopdb_v2.db_opened()
db = slopdb_v2.db
const object_stores = slopdb_v2.db.objectStoreNames const object_stores = slopdb_v2.db.objectStoreNames
expect(object_stores).toContain("slop") expect(object_stores).toContain("slop")
expect(object_stores).toContain("checkcache") expect(object_stores).toContain("checkcache")
// slopdb_v2.db.close() // slopdb_v2.db.close()
})
}) })
}) })