@@ -7649,56 +7649,84 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
76497649 } ) . pipe ( Effect . provide ( NodeHttpServer . layerTest ) ) ,
76507650 ) ;
76517651
7652- it . effect ( "re-emits the project after initializing its repository" , ( ) =>
7653- Effect . gen ( function * ( ) {
7654- const dispatched : Array < string > = [ ] ;
7655- const refreshedRoots : Array < string > = [ ] ;
7656- const metaUpdateDispatched = yield * Deferred . make < void > ( ) ;
7657- const project = makeDefaultOrchestrationReadModel ( ) . projects [ 0 ] ! ;
7652+ it . effect . each ( [ "init" , "publish" ] as const ) (
7653+ "re-emits the project after %s adds its repository" ,
7654+ ( action ) =>
7655+ Effect . gen ( function * ( ) {
7656+ const dispatched : Array < string > = [ ] ;
7657+ const refreshedRoots : Array < string > = [ ] ;
7658+ const metaUpdateDispatched = yield * Deferred . make < void > ( ) ;
7659+ const project = makeDefaultOrchestrationReadModel ( ) . projects [ 0 ] ! ;
76587660
7659- yield * buildAppUnderTest ( {
7660- layers : {
7661- orchestrationEngine : {
7662- dispatch : ( command ) =>
7663- Effect . sync ( ( ) => {
7664- dispatched . push ( command . type ) ;
7665- return { sequence : dispatched . length } ;
7666- } ) . pipe (
7667- Effect . tap ( ( ) =>
7668- command . type === "project.meta.update"
7669- ? Deferred . succeed ( metaUpdateDispatched , undefined )
7670- : Effect . void ,
7661+ yield * buildAppUnderTest ( {
7662+ layers : {
7663+ orchestrationEngine : {
7664+ dispatch : ( command ) =>
7665+ Effect . sync ( ( ) => {
7666+ dispatched . push ( command . type ) ;
7667+ return { sequence : dispatched . length } ;
7668+ } ) . pipe (
7669+ Effect . tap ( ( ) =>
7670+ command . type === "project.meta.update"
7671+ ? Deferred . succeed ( metaUpdateDispatched , undefined )
7672+ : Effect . void ,
7673+ ) ,
76717674 ) ,
7672- ) ,
7673- } ,
7674- projectionSnapshotQuery : {
7675- getActiveProjectByWorkspaceRoot : ( workspaceRoot ) =>
7676- Effect . succeed (
7677- workspaceRoot === project . workspaceRoot
7678- ? Option . some ( { ...project , repositoryIdentity : null } )
7679- : Option . none ( ) ,
7680- ) ,
7681- } ,
7682- repositoryIdentityResolver : {
7683- resolve : ( cwd , options ) =>
7684- Effect . sync ( ( ) => {
7685- if ( options ?. refresh ) refreshedRoots . push ( cwd ) ;
7686- return null ;
7687- } ) ,
7675+ } ,
7676+ projectionSnapshotQuery : {
7677+ getActiveProjectByWorkspaceRoot : ( workspaceRoot ) =>
7678+ Effect . succeed (
7679+ workspaceRoot === project . workspaceRoot
7680+ ? Option . some ( { ...project , repositoryIdentity : null } )
7681+ : Option . none ( ) ,
7682+ ) ,
7683+ } ,
7684+ repositoryIdentityResolver : {
7685+ resolve : ( cwd , options ) =>
7686+ Effect . sync ( ( ) => {
7687+ if ( options ?. refresh ) refreshedRoots . push ( cwd ) ;
7688+ return null ;
7689+ } ) ,
7690+ } ,
7691+ sourceControlRepositoryService : {
7692+ publishRepository : ( ) =>
7693+ Effect . succeed ( {
7694+ repository : {
7695+ provider : "github" ,
7696+ nameWithOwner : "t3tools/t3code" ,
7697+ url : "https://github.com/t3tools/t3code" ,
7698+ sshUrl :
"[email protected] :t3tools/t3code.git" , 7699+ } ,
7700+ remoteName : "origin" ,
7701+ remoteUrl :
"[email protected] :t3tools/t3code.git" , 7702+ branch : "main" ,
7703+ status : "pushed" ,
7704+ } ) ,
7705+ } ,
76887706 } ,
7689- } ,
7690- } ) ;
7707+ } ) ;
76917708
7692- const wsUrl = yield * getWsServerUrl ( "/ws" ) ;
7693- yield * Effect . scoped (
7694- withWsRpcClient ( wsUrl , ( client ) =>
7695- client [ WS_METHODS . vcsInit ] ( { cwd : project . workspaceRoot } ) ,
7696- ) ,
7697- ) ;
7698- yield * Deferred . await ( metaUpdateDispatched ) ;
7699- assert . deepEqual ( refreshedRoots , [ project . workspaceRoot ] ) ;
7700- assert . deepEqual ( dispatched , [ "project.meta.update" ] ) ;
7701- } ) . pipe ( Effect . provide ( NodeHttpServer . layerTest ) ) ,
7709+ const wsUrl = yield * getWsServerUrl ( "/ws" ) ;
7710+ yield * Effect . scoped (
7711+ withWsRpcClient ( wsUrl , ( client ) =>
7712+ Effect . gen ( function * ( ) {
7713+ if ( action === "init" ) {
7714+ yield * client [ WS_METHODS . vcsInit ] ( { cwd : project . workspaceRoot } ) ;
7715+ } else {
7716+ yield * client [ WS_METHODS . sourceControlPublishRepository ] ( {
7717+ cwd : project . workspaceRoot ,
7718+ provider : "github" ,
7719+ repository : "t3tools/t3code" ,
7720+ visibility : "private" ,
7721+ } ) ;
7722+ }
7723+ } ) ,
7724+ ) ,
7725+ ) ;
7726+ yield * Deferred . await ( metaUpdateDispatched ) ;
7727+ assert . deepEqual ( refreshedRoots , [ project . workspaceRoot ] ) ;
7728+ assert . deepEqual ( dispatched , [ "project.meta.update" ] ) ;
7729+ } ) . pipe ( Effect . provide ( NodeHttpServer . layerTest ) ) ,
77027730 ) ;
77037731
77047732 it . effect ( "records thread analytics only after a client command succeeds" , ( ) =>
0 commit comments