ffce066842
- Guard renderer project list/get against stale initial loads - Retry project zip/cache removal to handle transient Windows locks - Surface deletion failures in UI and add regression tests Made-with: Cursor
24 lines
972 B
TypeScript
24 lines
972 B
TypeScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
void test('projectState: list/get after delete invalidates in-flight initial load (epoch guard)', () => {
|
|
const src = fs.readFileSync(path.join(here, 'projectState.ts'), 'utf8');
|
|
assert.match(src, /projectDataEpochRef/);
|
|
assert.match(src, /const epoch = projectDataEpochRef\.current/);
|
|
assert.match(src, /if \(projectDataEpochRef\.current !== epoch\) return/);
|
|
assert.match(
|
|
src,
|
|
/const deleteProject = async[\s\S]+?projectDataEpochRef\.current \+= 1[\s\S]+?await api\.invoke/,
|
|
);
|
|
assert.match(
|
|
src,
|
|
/const openProject = async[\s\S]+?projectDataEpochRef\.current \+= 1[\s\S]+?await api\.invoke/,
|
|
);
|
|
assert.match(src, /const refreshProjects = async \(\) => \{[\s\S]+?projectDataEpochRef\.current \+= 1/);
|
|
});
|