@@ -87,6 +87,13 @@ describe("projectService", () => {
87
87
extractPackage : ( ) => Promise . resolve ( ) ,
88
88
} ) ;
89
89
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
+ } ) ;
90
97
91
98
return testInjector ;
92
99
} ;
@@ -98,16 +105,27 @@ describe("projectService", () => {
98
105
const projectService = testInjector . resolve < IProjectService > (
99
106
ProjectServiceLib . ProjectService
100
107
) ;
108
+ const projectDir = path . join ( dirToCreateProject , projectName ) ;
101
109
const projectCreationData = await projectService . createProject ( {
102
110
projectName : projectName ,
103
111
pathToProject : dirToCreateProject ,
104
112
force : true ,
105
113
template : constants . RESERVED_TEMPLATE_NAMES [ "default" ] ,
106
114
} ) ;
115
+
107
116
assert . deepStrictEqual ( projectCreationData , {
108
117
projectName,
109
- projectDir : path . join ( dirToCreateProject , projectName ) ,
118
+ projectDir,
110
119
} ) ;
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
+ ) ;
111
129
} ) ;
112
130
113
131
it ( "fails when invalid name is passed when projectNameService fails" , async ( ) => {
@@ -188,6 +206,7 @@ describe("projectService", () => {
188
206
downloadAndExtract : ( ) => Promise . resolve ( ) ,
189
207
} ) ;
190
208
testInjector . register ( "tempService" , TempServiceStub ) ;
209
+ testInjector . register ( "childProcess" , { } ) ;
191
210
192
211
return testInjector ;
193
212
} ;
0 commit comments