@@ -4748,6 +4748,36 @@ function mulberry32(seed: number) {
47484748}
47494749
47504750let mockProjectEventStore : RelayEvent [ ] | null = null ;
4751+ const MOCK_PROJECT_BRANCHES_KEY = "buzz-e2e-project-branches" ;
4752+
4753+ function readMockProjectBranches ( ) : Record < string , Record < string , string > > {
4754+ try {
4755+ return JSON . parse (
4756+ window . sessionStorage . getItem ( MOCK_PROJECT_BRANCHES_KEY ) ?? "{}" ,
4757+ ) ;
4758+ } catch {
4759+ return { } ;
4760+ }
4761+ }
4762+
4763+ function writeMockProjectBranch (
4764+ dtag : string ,
4765+ branch : string ,
4766+ commit : string | null ,
4767+ ) {
4768+ const projects = readMockProjectBranches ( ) ;
4769+ const branches = { ...( projects [ dtag ] ?? { } ) } ;
4770+ if ( commit ) {
4771+ branches [ branch ] = commit ;
4772+ } else {
4773+ delete branches [ branch ] ;
4774+ }
4775+ projects [ dtag ] = branches ;
4776+ window . sessionStorage . setItem (
4777+ MOCK_PROJECT_BRANCHES_KEY ,
4778+ JSON . stringify ( projects ) ,
4779+ ) ;
4780+ }
47514781
47524782function buildMockProjectEvents ( ) : RelayEvent [ ] {
47534783 const events : RelayEvent [ ] = [ ] ;
@@ -4795,8 +4825,11 @@ function buildMockProjectEvents(): RelayEvent[] {
47954825 } `,
47964826 ] ,
47974827 [ "refs/heads/main" , "0123456789abcdef0123456789abcdef01234567" ] ,
4828+ ...Object . entries ( readMockProjectBranches ( ) [ seed . dtag ] ?? { } ) . map (
4829+ ( [ branch , commit ] ) => [ `refs/heads/${ branch } ` , commit ] ,
4830+ ) ,
47984831 ] ,
4799- owner ,
4832+ getConfig ( ) ?. mock ?. relaySelf ?? owner ,
48004833 now - projectIndex ,
48014834 `mock-repo-state-${ seed . dtag } ` . replace ( / [ ^ a - z A - Z 0 - 9 ] / g, "" ) ,
48024835 ) ,
@@ -9427,6 +9460,9 @@ export function maybeInstallE2eTauriMocks() {
94279460 ] ) ;
94289461 repoState . created_at = Math . floor ( Date . now ( ) / 1000 ) ;
94299462 }
9463+ if ( dtag ) {
9464+ writeMockProjectBranch ( dtag , input . newBranch , input . expectedCommit ) ;
9465+ }
94309466 return {
94319467 branch : input . newBranch ,
94329468 commit : input . expectedCommit ,
@@ -9455,6 +9491,9 @@ export function maybeInstallE2eTauriMocks() {
94559491 ) ;
94569492 repoState . created_at = Math . floor ( Date . now ( ) / 1000 ) ;
94579493 }
9494+ if ( dtag ) {
9495+ writeMockProjectBranch ( dtag , input . branch , null ) ;
9496+ }
94589497 return {
94599498 branch : input . branch ,
94609499 commit : input . expectedCommit ,
0 commit comments