Skip to content

Commit 62b3593

Browse files
e2l3nVioletaDimova
authored andcommitted
Change test injector constructor.
1 parent f112420 commit 62b3593

File tree

1 file changed

+31
-36
lines changed

1 file changed

+31
-36
lines changed

test/project-service.ts

+31-36
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,26 @@
44
import yok = require('../lib/common/yok');
55
import stubs = require('./stubs');
66
import * as constants from "./../lib/constants";
7-
import {ChildProcess} from "../lib/common/child-process";
7+
import * as ChildProcessLib from "../lib/common/child-process";
88
import * as ProjectServiceLib from "../lib/services/project-service";
99
import * as ProjectDataServiceLib from "../lib/services/project-data-service";
1010
import * as ProjectDataLib from "../lib/project-data";
1111
import * as ProjectHelperLib from "../lib/common/project-helper";
12-
import {StaticConfig} from "../lib/config";
12+
import * as ConfigLib from "../lib/config";
1313
import * as NpmLib from "../lib/node-package-manager";
1414
import {NpmInstallationManager} from "../lib/npm-installation-manager";
1515
import * as HttpClientLib from "../lib/common/http-client";
16-
import {FileSystem} from "../lib/common/file-system";
16+
import * as FileSystemLib from "../lib/common/file-system";
1717
import * as path from "path";
1818
import temp = require("temp");
1919
import * as helpers from "../lib/common/helpers";
2020
import {assert} from "chai";
21-
import {Options} from "../lib/options";
22-
import {HostInfo} from "../lib/common/host-info";
23-
import {IOSProjectService} from "../lib/services/ios-project-service";
21+
import * as OptionsLib from "../lib/options";
22+
import * as HostInfoLib from "../lib/common/host-info";
23+
import * as iOSProjectServiceLib from "../lib/services/ios-project-service";
2424
import * as shell from "shelljs";
25+
import ErrorsLib = require("../lib/common/errors");
26+
2527

2628
let mockProjectNameValidator = {
2729
validate: () => { return true; }
@@ -104,25 +106,25 @@ class ProjectIntegrationTest {
104106

105107
private createTestInjector(): void {
106108
this.testInjector = new yok.Yok();
107-
this.testInjector.register("childProcess", ChildProcess);
109+
this.testInjector.register("childProcess", ChildProcessLib.ChildProcess);
108110
this.testInjector.register("errors", stubs.ErrorsStub);
109111
this.testInjector.register('logger', stubs.LoggerStub);
110112
this.testInjector.register("projectService", ProjectServiceLib.ProjectService);
111113
this.testInjector.register("projectHelper", ProjectHelperLib.ProjectHelper);
112114
this.testInjector.register("projectTemplatesService", stubs.ProjectTemplatesService);
113115
this.testInjector.register("projectNameValidator", mockProjectNameValidator);
114116

115-
this.testInjector.register("fs", FileSystem);
117+
this.testInjector.register("fs", FileSystemLib.FileSystem);
116118
this.testInjector.register("projectDataService", ProjectDataServiceLib.ProjectDataService);
117-
this.testInjector.register("staticConfig", StaticConfig);
119+
this.testInjector.register("staticConfig", ConfigLib.StaticConfig);
118120

119121
this.testInjector.register("npmInstallationManager", NpmInstallationManager);
120122
this.testInjector.register("npm", NpmLib.NodePackageManager);
121123
this.testInjector.register("httpClient", HttpClientLib.HttpClient);
122124
this.testInjector.register("lockfile", stubs.LockFile);
123125

124-
this.testInjector.register("options", Options);
125-
this.testInjector.register("hostInfo", HostInfo);
126+
this.testInjector.register("options", OptionsLib.Options);
127+
this.testInjector.register("hostInfo", HostInfoLib.HostInfo);
126128
}
127129
}
128130

@@ -204,51 +206,44 @@ function createTestInjector() {
204206
testInjector.register("projectHelper", ProjectHelperLib.ProjectHelper);
205207
testInjector.register("projectTemplatesService", stubs.ProjectTemplatesService);
206208
testInjector.register("projectNameValidator", mockProjectNameValidator);
207-
208-
testInjector.register("fs", FileSystem);
209+
testInjector.register("fs", FileSystemLib.FileSystem);
209210
testInjector.register("projectDataService", ProjectDataServiceLib.ProjectDataService);
210-
211-
testInjector.register("staticConfig", StaticConfig);
212-
211+
testInjector.register("staticConfig", ConfigLib.StaticConfig);
213212
testInjector.register("npmInstallationManager", NpmInstallationManager);
214213
testInjector.register("httpClient", HttpClientLib.HttpClient);
215214
testInjector.register("lockfile", stubs.LockFile);
216-
217-
testInjector.register("childProcess", ChildProcess);
218-
215+
testInjector.register("childProcess", ChildProcessLib.ChildProcess);
219216
testInjector.register('projectData', ProjectDataLib.ProjectData);
220-
testInjector.register("options", Options);
221-
testInjector.register("hostInfo", HostInfo);
217+
testInjector.register("options", OptionsLib.Options);
218+
testInjector.register("hostInfo", HostInfoLib.HostInfo);
222219

223220
return testInjector;
224221
}
225222

226223
function createInjectorForPodsTest() {
227224
let testInjector = new yok.Yok();
228-
229-
testInjector.register("errors", stubs.ErrorsStub);
230-
testInjector.register('logger', stubs.LoggerStub);
231-
testInjector.register("projectHelper", {});
225+
testInjector.register("childProcess", ChildProcessLib.ChildProcess);
226+
testInjector.register("config", ConfigLib.Configuration);
227+
testInjector.register("errors", ErrorsLib.Errors);
228+
testInjector.register("fs", FileSystemLib.FileSystem);
229+
testInjector.register("hostInfo", HostInfoLib.HostInfo);
230+
testInjector.register("injector", testInjector);
231+
testInjector.register("iOSEmulatorServices", {});
232+
testInjector.register("iOSProjectService", iOSProjectServiceLib.IOSProjectService);
233+
testInjector.register("options", OptionsLib.Options);
232234
testInjector.register("projectData", {
233235
projectName: "__PROJECT_NAME__",
234236
platformsDir: ""
235237
});
238+
testInjector.register("projectHelper", {});
239+
testInjector.register("staticConfig", ConfigLib.StaticConfig);
236240
testInjector.register("projectDataService", {});
237-
testInjector.register("iOSEmulatorServices", {});
241+
testInjector.register("prompter", {});
242+
testInjector.register('logger', stubs.LoggerStub);
238243
testInjector.register("config", {
239244
"USE_POD_SANDBOX": true
240245
});
241-
testInjector.register("prompter", {});
242-
testInjector.register("fs", FileSystem);
243-
testInjector.register("staticConfig", StaticConfig);
244246
testInjector.register("npmInstallationManager", NpmInstallationManager);
245-
testInjector.register("iOSProjectService", IOSProjectService);
246-
testInjector.register("projectService", ProjectServiceLib.ProjectService);
247-
testInjector.register("projectTemplatesService", stubs.ProjectTemplatesService);
248-
testInjector.register("projectNameValidator", mockProjectNameValidator);
249-
testInjector.register("options", Options);
250-
testInjector.register("hostInfo", HostInfo);
251-
testInjector.register("childProcess", ChildProcess);
252247

253248
return testInjector;
254249
}

0 commit comments

Comments
 (0)