Files
patch-db/client/tests/mocks/bootstrapper.mock.ts
2021-07-09 15:11:13 -06:00

21 lines
455 B
TypeScript

import { Bootstrapper, DBCache } from '../../lib/patch-db'
export class MockBootstrapper<T> implements Bootstrapper<T> {
constructor (
private sequence: number = 0,
private data: T = { } as T,
) { }
async init (): Promise<DBCache<T>> {
return {
sequence: this.sequence,
data: this.data as T,
}
}
async update (cache: DBCache<T>): Promise<void> {
this.sequence = cache.sequence
this.data = cache.data
}
}