Skip to content

Commit 8aa1a56

Browse files
committed
test(diff): cover runDiff --dry-run branch (offline canned sample)
1 parent b785773 commit 8aa1a56

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/commands/test.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,6 +2821,31 @@ describe('runDiff', () => {
28212821
expect(diff.crossTest).toBe(true);
28222822
expect(errs.join('\n')).toContain('different tests');
28232823
});
2824+
2825+
it('--dry-run returns the canned sample fully offline (no credentials, no fetch)', async () => {
2826+
// Dry-run must not require credentials or hit the network — it returns a
2827+
// canned CliRunDiff so `--dry-run` shows the shape offline.
2828+
const diff = await runDiff(
2829+
{
2830+
profile: 'default',
2831+
output: 'json',
2832+
debug: false,
2833+
dryRun: true,
2834+
runA: 'run_aaa',
2835+
runB: 'run_bbb',
2836+
},
2837+
{ stdout: () => undefined, stderr: () => undefined },
2838+
);
2839+
expect(diff.runA.runId).toBe('run_aaa');
2840+
expect(diff.runB.runId).toBe('run_bbb');
2841+
expect(diff.verdictChanged).toBe(true);
2842+
expect(diff.changedSteps).toHaveLength(1);
2843+
expect(diff.changedSteps[0]).toMatchObject({
2844+
stepIndex: 2,
2845+
statusA: 'passed',
2846+
statusB: 'failed',
2847+
});
2848+
});
28242849
});
28252850

28262851
describe('runResult', () => {

0 commit comments

Comments
 (0)