Files
Agent-System/web/src/lib/afterProjectMemberPersisted.test.ts
T
weichenandCursor 8b6bf2cca1 fix(api): sync removed members and fail tasks without a ledger
Remove now reconciles document slots and returns ERR_DUTY_SYNC on
failure. CreateOrGetDocument errors abort the task. The frontend
refreshes workflow docs after add, update, restore, and remove.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 22:29:53 +00:00

34 lines
923 B
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { afterProjectMemberPersisted } from './afterProjectMemberPersisted';
test('afterProjectMemberPersisted syncs members then refreshes workflow docs', async () => {
const calls: string[] = [];
await afterProjectMemberPersisted({
syncMembers: async () => {
calls.push('sync');
},
refreshWorkflowDocs: () => {
calls.push('refresh');
},
});
assert.deepEqual(calls, ['sync', 'refresh']);
});
test('afterProjectMemberPersisted does not refresh when member sync fails', async () => {
let refreshed = false;
await assert.rejects(
() =>
afterProjectMemberPersisted({
syncMembers: async () => {
throw new Error('sync failed');
},
refreshWorkflowDocs: () => {
refreshed = true;
},
}),
/sync failed/,
);
assert.equal(refreshed, false);
});