@@ -10,7 +10,7 @@ import {
10
10
IProjectDataService ,
11
11
IProjectService ,
12
12
} from "../lib/definitions/project" ;
13
- import { IProjectNameService } from "../lib/declarations" ;
13
+ import { IOptions , IProjectNameService } from "../lib/declarations" ;
14
14
import { IInjector } from "../lib/common/definitions/yok" ;
15
15
import { IDictionary , IFileSystem } from "../lib/common/declarations" ;
16
16
import { ProjectConfigService } from "../lib/services/project-config-service" ;
@@ -118,6 +118,26 @@ describe("projectService", () => {
118
118
projectName,
119
119
projectDir,
120
120
} ) ;
121
+ } ) ;
122
+
123
+ it ( "creates a git repo" , async ( ) => {
124
+ const projectName = invalidProjectName ;
125
+ const testInjector = getTestInjector ( { projectName } ) ;
126
+ const options = testInjector . resolve < IOptions > ( "options" ) ;
127
+ const projectService = testInjector . resolve < IProjectService > (
128
+ ProjectServiceLib . ProjectService
129
+ ) ;
130
+ const projectDir = path . join ( dirToCreateProject , projectName ) ;
131
+
132
+ // force creation to skip git repo check...
133
+ options . force = true ;
134
+
135
+ await projectService . createProject ( {
136
+ projectName : projectName ,
137
+ pathToProject : dirToCreateProject ,
138
+ force : true ,
139
+ template : constants . RESERVED_TEMPLATE_NAMES [ "default" ] ,
140
+ } ) ;
121
141
122
142
assert . deepEqual (
123
143
testInjector . resolve ( "childProcess" ) . _getExecutedCommands ( ) ,
@@ -129,6 +149,30 @@ describe("projectService", () => {
129
149
) ;
130
150
} ) ;
131
151
152
+ it ( "does not create a git repo with --no-git" , async ( ) => {
153
+ const projectName = invalidProjectName ;
154
+ const testInjector = getTestInjector ( { projectName } ) ;
155
+ const options = testInjector . resolve < IOptions > ( "options" ) ;
156
+ const projectService = testInjector . resolve < IProjectService > (
157
+ ProjectServiceLib . ProjectService
158
+ ) ;
159
+
160
+ // simulate --no-git
161
+ options . git = false ;
162
+
163
+ await projectService . createProject ( {
164
+ projectName : projectName ,
165
+ pathToProject : dirToCreateProject ,
166
+ force : true ,
167
+ template : constants . RESERVED_TEMPLATE_NAMES [ "default" ] ,
168
+ } ) ;
169
+
170
+ assert . deepEqual (
171
+ testInjector . resolve ( "childProcess" ) . _getExecutedCommands ( ) ,
172
+ [ ]
173
+ ) ;
174
+ } ) ;
175
+
132
176
it ( "fails when invalid name is passed when projectNameService fails" , async ( ) => {
133
177
const projectName = invalidProjectName ;
134
178
const testInjector = getTestInjector ( { projectName } ) ;
0 commit comments