mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 17:26:24 +00:00
fix(client): work through the findings from the coverage pass
214 items came out of writing the tests. Real defects are corrected, dead code is removed rather than covered, and the tests that pinned the old behaviour move with them. Also drops two agent coverage scratch files that slipped into the coverage PR and adds the ignore rule that keeps them out.
This commit is contained in:
@@ -59,6 +59,7 @@ export interface SyncMeta {
|
||||
status: 'idle' | 'syncing' | 'error';
|
||||
/** Bounding box [minLng, minLat, maxLng, maxLat] of pre-downloaded map tiles */
|
||||
tilesBbox: [number, number, number, number] | null;
|
||||
/** Non-photo files available offline for this trip after the last sync. */
|
||||
filesCachedCount: number;
|
||||
}
|
||||
|
||||
@@ -217,9 +218,13 @@ export async function reopenAnonymous(): Promise<void> {
|
||||
* DB. Used on logout so no trace of the account's data remains on the device.
|
||||
*/
|
||||
export async function deleteCurrentUserDb(): Promise<void> {
|
||||
if (_db.name !== ANON_DB_NAME) {
|
||||
try { await _db.delete(); } catch { /* ignore — fall through to anon */ }
|
||||
// Already anonymous: there is nothing to delete, and opening a second
|
||||
// connection to the same name would leak the current handle for the session.
|
||||
if (_db.name === ANON_DB_NAME) {
|
||||
await switchTo(ANON_DB_NAME);
|
||||
return;
|
||||
}
|
||||
try { await _db.delete(); } catch { /* ignore — fall through to anon */ }
|
||||
_db = new TrekOfflineDb(ANON_DB_NAME);
|
||||
await _db.open();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user