mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
test(sqlite): finalize repo and storage conformance
This commit is contained in:
parent
fd09e396a8
commit
bf7acdcc18
7 changed files with 141 additions and 179 deletions
|
|
@ -152,7 +152,6 @@ export class SqliteSessionRepo {
|
|||
|
||||
async create(options: SqliteSessionCreateOptions | undefined, _context: Context): Promise<SqliteOpenSession> {
|
||||
options ??= {};
|
||||
await mkdir(this.directory, { recursive: true });
|
||||
const createdAt = this.now();
|
||||
const id = options.id ?? uuidv7(createdAt);
|
||||
this.reserveId(id);
|
||||
|
|
@ -163,6 +162,7 @@ export class SqliteSessionRepo {
|
|||
let initialized = false;
|
||||
let session: SqliteOpenSession | undefined;
|
||||
try {
|
||||
await mkdir(this.directory, { recursive: true });
|
||||
const file = await openFile(path, "wx");
|
||||
await file.close();
|
||||
reservedFile = true;
|
||||
|
|
|
|||
|
|
@ -106,12 +106,12 @@ export class SqliteStorage implements Storage {
|
|||
|
||||
scanBranch(query: StorageBranchScan, _context: Context): Promise<Entry[]> {
|
||||
if (this.state !== "open") return Promise.reject(new Error("SqliteStorage is closed"));
|
||||
return Promise.resolve(scanBranchEntries(this.db, query));
|
||||
return Promise.resolve().then(() => scanBranchEntries(this.db, query));
|
||||
}
|
||||
|
||||
scanBranchStructure(query: StorageBranchScan, _context: Context): Promise<EntryStructure[]> {
|
||||
if (this.state !== "open") return Promise.reject(new Error("SqliteStorage is closed"));
|
||||
return Promise.resolve(scanBranchEntryStructures(this.db, query));
|
||||
return Promise.resolve().then(() => scanBranchEntryStructures(this.db, query));
|
||||
}
|
||||
|
||||
scanEntries(query: EntryScan, _context: Context): Promise<Entry[]> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue