@@ -9,6 +9,7 @@ import * as Fiber from "effect/Fiber";
99import * as FileSystem from "effect/FileSystem" ;
1010import * as Layer from "effect/Layer" ;
1111import * as Option from "effect/Option" ;
12+ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner" ;
1213import * as Queue from "effect/Queue" ;
1314import * as Result from "effect/Result" ;
1415import * as Schema from "effect/Schema" ;
@@ -63,6 +64,14 @@ const repositoryJson = {
6364 mainbranch : { name : "main" } ,
6465} ;
6566
67+ const gitOutput = ( stdout : string ) => ( {
68+ exitCode : ChildProcessSpawner . ExitCode ( 0 ) ,
69+ stdout,
70+ stderr : "" ,
71+ stdoutTruncated : false ,
72+ stderrTruncated : false ,
73+ } ) ;
74+
6675function makeLayer ( input : {
6776 readonly response : ( request : HttpClientRequest . HttpClientRequest ) => Response ;
6877 /** Holds the answer until it resolves, in place of answering at once. */
@@ -85,6 +94,9 @@ function makeLayer(input: {
8594 ) ,
8695 ) ;
8796 const gitMock = {
97+ execute : vi . fn < HostGit [ "execute" ] > ( ( ) =>
98+ Effect . succeed ( gitOutput ( "[email protected] :pingdotgg/t3code.git\n" ) ) , 99+ ) ,
88100 readConfigValue : vi . fn < HostGit [ "readConfigValue" ] > ( ( ) =>
89101 Effect . succeed < string | null > ( "[email protected] :pingdotgg/t3code.git" ) , 90102 ) ,
@@ -254,9 +266,16 @@ it.effect.each([false, true])("honors PR URL repositories, context=%s", (withCon
254266} ) ;
255267
256268it . effect ( "adds a fork remote with the protocol of the URL origin fetches from" , ( ) => {
257- // `readConfigValue` answers `remote. origin.url` with an SSH second URL.
269+ // `git remote -v` shows origin's SSH `insteadOf` rewrite; config holds HTTPS, then an SSH push URL.
258270 const { git, layer } = makeLayer ( {
259- remoteUrl : "https://bitbucket.org/pingdotgg/t3code.git" ,
271+ git : {
272+ execute : ( ) =>
273+ Effect . succeed (
274+ gitOutput (
275+ "https://bitbucket.org/pingdotgg/t3code.git\[email protected] :pingdotgg/t3code.git\n" , 276+ ) ,
277+ ) ,
278+ } ,
260279 response : ( request ) =>
261280 Response . json (
262281 request . url . endsWith ( "/pullrequests/42" )
0 commit comments