Fix two intermittently failing library tests (closes #90)
check / check (push) Successful in 15s
check / check (push) Successful in 15s
Library.close() now returns a promise that resolves once the work it started has finished: an in-flight refresh with its cache write, the ML data fetch, and running precache sweeps. The interval test could see a refresh's new state, close, and remove the directory while the write was still running. Every library test now awaits close(), and a new test holds a cache write open to prove close() waits for it. The precache test waited for its stub source to be called, but the cache records a file only after checking it on disk, so status() could lag. It now waits for both fills to report "done". Model: opus-5-5
This commit is contained in:
@@ -159,7 +159,7 @@ describe("Library.snapshot and Library.subscribe", () => {
|
||||
for (const p of snap.photos) expect("key" in p).toBe(false);
|
||||
for (const a of snap.albums) expect("key" in a).toBe(false);
|
||||
} finally {
|
||||
lib.close();
|
||||
await lib.close();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -219,7 +219,7 @@ describe("Library.snapshot and Library.subscribe", () => {
|
||||
expect(change.refreshedAt).toBeGreaterThan(0);
|
||||
} finally {
|
||||
unsubscribe();
|
||||
lib.close();
|
||||
await lib.close();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -251,7 +251,7 @@ describe("Library.snapshot and Library.subscribe", () => {
|
||||
expect(changes).toEqual([]);
|
||||
} finally {
|
||||
unsubscribe();
|
||||
lib.close();
|
||||
await lib.close();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -297,7 +297,7 @@ describe("Library.snapshot and Library.subscribe", () => {
|
||||
);
|
||||
expect(changes).toEqual([]);
|
||||
} finally {
|
||||
lib.close();
|
||||
await lib.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user