Files
maestro/ui/src/components/spaces/AppRunner.autoapprove.test.tsx
T
oss-sync b857c33ef6
CI / build-and-test (push) Has been cancelled
sync: update from private repo (f6d625db)
2026-06-26 03:35:45 +00:00

23 lines
918 B
TypeScript

/**
* Pure-function tests for shouldConfirmWrite.
* No DOM render needed — these run in node env.
*/
import { describe, it, expect } from 'vitest';
import { shouldConfirmWrite } from './app-bridge';
describe('shouldConfirmWrite', () => {
it('returns false when autoApprove=true (always bypass confirm)', () => {
// Even a path that would normally require confirm is bypassed.
expect(shouldConfirmWrite('my-app', 'some/arbitrary/file.txt', true)).toBe(false);
});
it('returns false when path is under output/ (allowlisted, no confirm needed)', () => {
expect(shouldConfirmWrite('my-app', 'output/report.csv', false)).toBe(false);
});
it('returns true when autoApprove=false and path is NOT allowlisted', () => {
// A path not under output/ or apps/{appName}/data/ must trigger a confirm.
expect(shouldConfirmWrite('my-app', 'some/arbitrary/file.txt', false)).toBe(true);
});
});