@@ -87,6 +87,13 @@ describe("projectService", () => {
8787 extractPackage : ( ) => Promise . resolve ( ) ,
8888 } ) ;
8989 testInjector . register ( "tempService" , TempServiceStub ) ;
90+ const executedCommands : string [ ] = [ ] ;
91+ testInjector . register ( "childProcess" , {
92+ _getExecutedCommands : ( ) => executedCommands ,
93+ exec : ( executedCommand : string ) => {
94+ executedCommands . push ( executedCommand ) ;
95+ } ,
96+ } ) ;
9097
9198 return testInjector ;
9299 } ;
@@ -98,16 +105,27 @@ describe("projectService", () => {
98105 const projectService = testInjector . resolve < IProjectService > (
99106 ProjectServiceLib . ProjectService
100107 ) ;
108+ const projectDir = path . join ( dirToCreateProject , projectName ) ;
101109 const projectCreationData = await projectService . createProject ( {
102110 projectName : projectName ,
103111 pathToProject : dirToCreateProject ,
104112 force : true ,
105113 template : constants . RESERVED_TEMPLATE_NAMES [ "default" ] ,
106114 } ) ;
115+
107116 assert . deepStrictEqual ( projectCreationData , {
108117 projectName,
109- projectDir : path . join ( dirToCreateProject , projectName ) ,
118+ projectDir,
110119 } ) ;
120+
121+ assert . deepEqual (
122+ testInjector . resolve ( "childProcess" ) . _getExecutedCommands ( ) ,
123+ [
124+ `git init ${ projectDir } ` ,
125+ `git -C ${ projectDir } add --all` ,
126+ `git -C ${ projectDir } commit --no-verify -m "init"` ,
127+ ]
128+ ) ;
111129 } ) ;
112130
113131 it ( "fails when invalid name is passed when projectNameService fails" , async ( ) => {
@@ -188,6 +206,7 @@ describe("projectService", () => {
188206 downloadAndExtract : ( ) => Promise . resolve ( ) ,
189207 } ) ;
190208 testInjector . register ( "tempService" , TempServiceStub ) ;
209+ testInjector . register ( "childProcess" , { } ) ;
191210
192211 return testInjector ;
193212 } ;
0 commit comments