start working on slopstore class analogous to checkcache class
This commit is contained in:
@@ -3,11 +3,7 @@ import { openDB, deleteDB } from "../scripts/idb/index.js"
|
||||
|
||||
const MAX_TIMESTAMP_DIFFERENCE = 3
|
||||
|
||||
xdescribe("sanity check", () => {
|
||||
it("works", () => {
|
||||
expect(true).toBeTrue()
|
||||
})
|
||||
})
|
||||
let mock_clock = jasmine.clock().install()
|
||||
|
||||
describe("SlopDB", () => {
|
||||
|
||||
@@ -38,11 +34,8 @@ describe("SlopDB", () => {
|
||||
describe("version 2", () => {
|
||||
|
||||
let slopdb
|
||||
let mock_clock
|
||||
|
||||
beforeAll(() => {
|
||||
const j_clock = jasmine.clock()
|
||||
mock_clock = j_clock.install()
|
||||
mock_clock.mockDate(new Date(2020, 1, 1))
|
||||
})
|
||||
|
||||
@@ -61,6 +54,31 @@ describe("SlopDB", () => {
|
||||
// slopdb_v2.db.close()
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
describe("CheckCache", () => {
|
||||
let db
|
||||
let slopdb
|
||||
|
||||
beforeAll(() => {
|
||||
mock_clock.mockDate(new Date(2020, 1, 1))
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
await deleteDB("SlopDB")
|
||||
slopdb = new SlopDB(2)
|
||||
await slopdb.db_opened()
|
||||
db = slopdb.db
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
db.close()
|
||||
})
|
||||
|
||||
it("caches a checked url", async () => {
|
||||
const cache = slopdb.check_cache
|
||||
expect(cache).toBeInstanceOf(CheckCache)
|
||||
@@ -114,7 +132,28 @@ describe("SlopDB", () => {
|
||||
expect(get_slop1).toBeUndefined()
|
||||
expect(cache.size).toEqual(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe("SlopStore", () => {
|
||||
let db
|
||||
let slopdb
|
||||
|
||||
beforeAll(() => {
|
||||
mock_clock.mockDate(new Date(2020, 1, 1))
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
await deleteDB("SlopDB")
|
||||
slopdb = new SlopDB(2)
|
||||
await slopdb.db_opened()
|
||||
db = slopdb.db
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
db.close()
|
||||
})
|
||||
|
||||
it("passes", () => {
|
||||
expect(true).toBeTrue()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -55,6 +55,14 @@ export class SlopStore {
|
||||
constructor(slopdb: IDBPDatabase) {
|
||||
this.slopdb = slopdb
|
||||
}
|
||||
|
||||
async store(domain: string, path: string) {
|
||||
|
||||
}
|
||||
|
||||
async get(url: string) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export class SlopDB {
|
||||
|
||||
Reference in New Issue
Block a user