bun test v1.4.4 (38afee6c8) student-tests/git-proof-cli.test.ts: (pass) real Git checkout default remains native Git without proof flags [0.31ms] 1 | import {test,expect} from 'bun:test';import {createAcceptCommand,parseGitProofCLI} from '../scripts/git-proof-cli'; 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); ^ error: expect(received).toEqual(expected) { - "kind": "canonical-proof", - "path": "evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json", - "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "kind": "native-git", } - Expected - 3 + Received + 1 at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:5:142) (fail) ZIP canonical proof is selected and verified before password or acceptance [2.77ms] 1 | import {test,expect} from 'bun:test';import {createAcceptCommand,parseGitProofCLI} from '../scripts/git-proof-cli'; 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); 6 | test.each([['--git-proof'],['--git-proof',path],['--git-proof-sha',sha],['--git-proof',path,'--git-proof-sha','invalid'],['--git-proof',path,'--git-proof-sha',sha,'--git-proof',path]])('malformed proof flags reject before credentials: %j',async(...items)=>{const f=fixture();await expect(createAcceptCommand(f.ports)(items)).rejects.toThrow('GIT_PROOF_CLI_INVALID');expect(f.calls).toEqual([]);}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:6:334) (fail) malformed proof flags reject before credentials: "--git-proof" [0.12ms] 1 | import {test,expect} from 'bun:test';import {createAcceptCommand,parseGitProofCLI} from '../scripts/git-proof-cli'; 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); 6 | test.each([['--git-proof'],['--git-proof',path],['--git-proof-sha',sha],['--git-proof',path,'--git-proof-sha','invalid'],['--git-proof',path,'--git-proof-sha',sha,'--git-proof',path]])('malformed proof flags reject before credentials: %j',async(...items)=>{const f=fixture();await expect(createAcceptCommand(f.ports)(items)).rejects.toThrow('GIT_PROOF_CLI_INVALID');expect(f.calls).toEqual([]);}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:6:334) (fail) malformed proof flags reject before credentials: "--git-proof" [0.04ms] 1 | import {test,expect} from 'bun:test';import {createAcceptCommand,parseGitProofCLI} from '../scripts/git-proof-cli'; 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); 6 | test.each([['--git-proof'],['--git-proof',path],['--git-proof-sha',sha],['--git-proof',path,'--git-proof-sha','invalid'],['--git-proof',path,'--git-proof-sha',sha,'--git-proof',path]])('malformed proof flags reject before credentials: %j',async(...items)=>{const f=fixture();await expect(createAcceptCommand(f.ports)(items)).rejects.toThrow('GIT_PROOF_CLI_INVALID');expect(f.calls).toEqual([]);}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:6:334) (fail) malformed proof flags reject before credentials: "--git-proof-sha" [0.04ms] 1 | import {test,expect} from 'bun:test';import {createAcceptCommand,parseGitProofCLI} from '../scripts/git-proof-cli'; 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); 6 | test.each([['--git-proof'],['--git-proof',path],['--git-proof-sha',sha],['--git-proof',path,'--git-proof-sha','invalid'],['--git-proof',path,'--git-proof-sha',sha,'--git-proof',path]])('malformed proof flags reject before credentials: %j',async(...items)=>{const f=fixture();await expect(createAcceptCommand(f.ports)(items)).rejects.toThrow('GIT_PROOF_CLI_INVALID');expect(f.calls).toEqual([]);}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:6:334) (fail) malformed proof flags reject before credentials: "--git-proof" [0.03ms] 1 | import {test,expect} from 'bun:test';import {createAcceptCommand,parseGitProofCLI} from '../scripts/git-proof-cli'; 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); 6 | test.each([['--git-proof'],['--git-proof',path],['--git-proof-sha',sha],['--git-proof',path,'--git-proof-sha','invalid'],['--git-proof',path,'--git-proof-sha',sha,'--git-proof',path]])('malformed proof flags reject before credentials: %j',async(...items)=>{const f=fixture();await expect(createAcceptCommand(f.ports)(items)).rejects.toThrow('GIT_PROOF_CLI_INVALID');expect(f.calls).toEqual([]);}); ^ error: expect(received).rejects.toThrow(expected) Expected promise that rejects Received promise that resolved: Promise { } at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:6:334) (fail) malformed proof flags reject before credentials: "--git-proof" [0.03ms] 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); 6 | test.each([['--git-proof'],['--git-proof',path],['--git-proof-sha',sha],['--git-proof',path,'--git-proof-sha','invalid'],['--git-proof',path,'--git-proof-sha',sha,'--git-proof',path]])('malformed proof flags reject before credentials: %j',async(...items)=>{const f=fixture();await expect(createAcceptCommand(f.ports)(items)).rejects.toThrow('GIT_PROOF_CLI_INVALID');expect(f.calls).toEqual([]);}); 7 | test('missing or changed proof preserves reader error and never reads password',async()=>{const f=fixture(),error=Error('GIT_PROOF_SHA_MISMATCH');f.ports.verifyProof=async()=>{throw error;};let actual;try{await createAcceptCommand(f.ports)(args);}catch(e){actual=e;}expect(actual).toBe(error);expect(f.calls).toEqual([]);}); ^ error: expect(received).toBe(expected) Expected: 2 | const path='evidence/openbao/canonical-git-proof-11111111-1111-4111-8111-111111111111.json',sha='a'.repeat(64),args=['--checked-cache','--git-proof',path,'--git-proof-sha',sha]; 3 | function fixture(){const calls:string[]=[];return{calls,ports:{verifyProof:async(p:unknown)=>{calls.push('proof');},password:async()=>{calls.push('password');return 'fixture password';},accept:async(_password:string,proof:unknown)=>{calls.push('accept');}}};} 4 | test('real Git checkout default remains native Git without proof flags',async()=>{const f=fixture();expect(parseGitProofCLI(['--checked-cache'])).toEqual({kind:'native-git'});await createAcceptCommand(f.ports)([]);expect(f.calls).toEqual(['password','accept']);}); 5 | test('ZIP canonical proof is selected and verified before password or acceptance',async()=>{const f=fixture();expect(parseGitProofCLI(args)).toEqual({kind:'canonical-proof',path,sha256:sha});await createAcceptCommand(f.ports)(args);expect(f.calls).toEqual(['proof','password','accept']);}); 6 | test.each([['--git-proof'],['--git-proof',path],['--git-proof-sha',sha],['--git-proof',path,'--git-proof-sha','invalid'],['--git-proof',path,'--git-proof-sha',sha,'--git-proof',path]])('malformed proof flags reject before credentials: %j',async(...items)=>{const f=fixture();await expect(createAcceptCommand(f.ports)(items)).rejects.toThrow('GIT_PROOF_CLI_INVALID');expect(f.calls).toEqual([]);}); 7 | test('missing or changed proof preserves reader error and never reads password',async()=>{const f=fixture(),error=Error('GIT_PROOF_SHA_MISMATCH');f.ports.verifyProof=async()=>{throw error;};let actual;try{await createAcceptCommand(f.ports)(args);}catch(e){actual=e;}expect(actual).toBe(error);expect(f.calls).toEqual([]);}); ^ error: GIT_PROOF_SHA_MISMATCH at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:7:115) Received: undefined at (/Users/rey/mtuci/vp/lab7/student-tests/git-proof-cli.test.ts:7:282) (fail) missing or changed proof preserves reader error and never reads password [0.29ms] (pass) workflow ports have no filesystem, prompt or stand defaults [0.03ms] 2 pass 7 fail 10 expect() calls Ran 9 tests across 1 file. [29.00ms]