Keep claim, review, and approval on one server record so the open document and the sidebar stay in the same state. Co-authored-by: Cursor <cursoragent@cursor.com>
17 lines
829 B
TypeScript
17 lines
829 B
TypeScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import test from 'node:test';
|
|
|
|
test('document lifecycle actions live in one hook', () => {
|
|
const app = readFileSync(new URL('../App.tsx', import.meta.url), 'utf8');
|
|
const hook = readFileSync(new URL('./useDocumentLifecycleActions.ts', import.meta.url), 'utf8');
|
|
assert.equal((app.match(/useDocumentLifecycleActions\(/g) || []).length, 1);
|
|
assert.equal(app.includes('claimDocument('), false);
|
|
assert.equal(app.includes('approverDecision('), false);
|
|
assert.equal(hook.includes('claimDocument'), true);
|
|
assert.equal(hook.includes('submitForReview'), true);
|
|
assert.equal(hook.includes('reviewDecision'), true);
|
|
assert.equal(hook.includes('approverDecision'), true);
|
|
assert.equal(hook.includes("rollback_to: 'drafting'"), true);
|
|
});
|