(tc: TestCase)
| 114 | }); |
| 115 | |
| 116 | const runTestCase = async (tc: TestCase) => { |
| 117 | const fakeResponsesPath = join(import.meta.dirname, tc.responsesFile); |
| 118 | rig.setup(tc.name, { fakeResponsesPath }); |
| 119 | |
| 120 | testFile = rig.createFile('test.txt', 'Lorem\nIpsum\nDolor\n'); |
| 121 | const args = ['-p', tc.promptCommand.prompt(testFile)]; |
| 122 | |
| 123 | if (tc.policyContent) { |
| 124 | const policyPath = rig.createFile('test-policy.toml', tc.policyContent); |
| 125 | args.push('--policy', policyPath); |
| 126 | } |
| 127 | |
| 128 | const result = await rig.run({ |
| 129 | args, |
| 130 | approvalMode: 'default', |
| 131 | }); |
| 132 | |
| 133 | await verifyToolExecution( |
| 134 | rig, |
| 135 | tc.promptCommand, |
| 136 | result, |
| 137 | tc.expectAllowed, |
| 138 | tc.expectedDenialString, |
| 139 | ); |
| 140 | }; |
| 141 | |
| 142 | const testCases = [ |
| 143 | { |
no test coverage detected