Files
Agent-System/web/src/hooks/useProjectMemberActions.test.ts
T
weichenandCursor 8de29466e1 refactor(web): persist project members from one hook
Refresh the roster and workflow documents only after the member write succeeds, so a failed add does not invent a local session.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 12:11:52 +00:00

15 lines
788 B
TypeScript

import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
test('project member writes live in one hook before the login return', () => {
const app = readFileSync(new URL('../App.tsx', import.meta.url), 'utf8');
const hook = readFileSync(new URL('./useProjectMemberActions.ts', import.meta.url), 'utf8');
assert.equal((app.match(/useProjectMemberActions\(/g) || []).length, 1);
assert.equal(app.indexOf('useProjectMemberActions(') < app.indexOf('if (!session)'), true);
assert.equal(app.includes('afterProjectMemberPersisted'), false);
assert.equal(hook.includes('afterProjectMemberPersisted'), true);
assert.equal(hook.includes('removeProjectMember'), true);
assert.equal(hook.includes("status: 'active'"), true);
});