Skip to content

Commit ec517bb

Browse files
author
Dimitar Kerezov
committed
Update common with latest bits
1 parent e952a63 commit ec517bb

File tree

4 files changed

+53
-49
lines changed

4 files changed

+53
-49
lines changed

test/npm-support.ts

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function createTestInjector(): IInjector {
4545
testInjector.register("androidProjectService", {});
4646
testInjector.register("iOSProjectService", {});
4747
testInjector.register("devicesServices", {});
48+
testInjector.register("resources", {});
4849
testInjector.register("projectData", ProjectDataLib.ProjectData);
4950
testInjector.register("projectHelper", ProjectHelperLib.ProjectHelper);
5051
testInjector.register("projectDataService", ProjectDataServiceLib.ProjectDataService);

test/platform-commands.ts

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function createTestInjector() {
9898
testInjector.registerCommand("platform|remove", PlatformRemoveCommandLib.RemovePlatformCommand);
9999
testInjector.registerCommand("platform|update", PlatformUpdateCommandLib.UpdatePlatformCommand);
100100
testInjector.register("lockfile", { });
101+
testInjector.register("resources", {});
101102
testInjector.register("commandsServiceProvider", {
102103
registerDynamicSubCommands: () => {}
103104
});

test/plugins-service.ts

+50-48
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,73 @@
11
/// <reference path=".d.ts" />
22
"use strict";
33

4-
import yok = require('../lib/common/yok');
5-
import stubs = require('./stubs');
6-
import NpmLib = require("../lib/node-package-manager");
7-
import FsLib = require("../lib/common/file-system");
8-
import ProjectDataLib = require("../lib/project-data");
9-
import ChildProcessLib = require("../lib/common/child-process");
10-
import PlatformServiceLib = require('../lib/services/platform-service');
11-
import OptionsLib = require("../lib/options");
12-
import CommandsServiceLib = require("../lib/common/services/commands-service");
13-
import StaticConfigLib = require("../lib/config");
14-
import HostInfoLib = require("../lib/common/host-info");
15-
import ErrorsLib = require("../lib/common/errors");
16-
import ProjectHelperLib = require("../lib/common/project-helper");
17-
import PlatformsDataLib = require("../lib/platforms-data");
18-
import ProjectDataServiceLib = require("../lib/services/project-data-service");
19-
import helpers = require("../lib/common/helpers");
20-
import ProjectFilesManagerLib = require("../lib/services/project-files-manager");
21-
import os = require("os");
4+
import {Yok} from '../lib/common/yok';
5+
import * as stubs from './stubs';
6+
import {NodePackageManager} from "../lib/node-package-manager";
7+
import {FileSystem} from "../lib/common/file-system";
8+
import {ProjectData} from "../lib/project-data";
9+
import {ChildProcess} from "../lib/common/child-process";
10+
import {PlatformService} from '../lib/services/platform-service';
11+
import {Options} from "../lib/options";
12+
import {CommandsService} from "../lib/common/services/commands-service";
13+
import {StaticConfig} from "../lib/config";
14+
import {HostInfo} from "../lib/common/host-info";
15+
import {Errors} from "../lib/common/errors";
16+
import {ProjectHelper} from "../lib/common/project-helper";
17+
import {PlatformsData} from "../lib/platforms-data";
18+
import {ProjectDataService} from "../lib/services/project-data-service";
19+
import * as helpers from "../lib/common/helpers";
20+
import {ProjectFilesManager} from "../lib/services/project-files-manager";
21+
import {ResourceLoader} from "../lib/common/resource-loader";
22+
import * as os from "os";
2223

23-
import PluginsServiceLib = require("../lib/services/plugins-service");
24-
import AddPluginCommandLib = require("../lib/commands/plugin/add-plugin");
24+
import {PluginsService} from "../lib/services/plugins-service";
25+
import {AddPluginCommand} from "../lib/commands/plugin/add-plugin";
2526

26-
import path = require("path");
27-
import temp = require("temp");
27+
import * as path from "path";
28+
import * as temp from "temp";
2829
temp.track();
2930

3031
let assert = require("chai").assert;
3132
let isErrorThrown = false;
3233

3334
function createTestInjector() {
34-
let testInjector = new yok.Yok();
35+
let testInjector = new Yok();
3536

36-
testInjector.register("npm", NpmLib.NodePackageManager);
37-
testInjector.register("fs", FsLib.FileSystem);
38-
testInjector.register("projectData", ProjectDataLib.ProjectData);
37+
testInjector.register("npm", NodePackageManager);
38+
testInjector.register("fs", FileSystem);
39+
testInjector.register("projectData", ProjectData);
3940
testInjector.register("platforsmData", stubs.PlatformsDataStub);
40-
testInjector.register("childProcess", ChildProcessLib.ChildProcess);
41-
testInjector.register("platformService", PlatformServiceLib.PlatformService);
42-
testInjector.register("platformsData", PlatformsDataLib.PlatformsData);
41+
testInjector.register("childProcess", ChildProcess);
42+
testInjector.register("platformService", PlatformService);
43+
testInjector.register("platformsData", PlatformsData);
4344
testInjector.register("androidProjectService", {});
4445
testInjector.register("iOSProjectService", {});
4546
testInjector.register("devicesServices", {});
46-
testInjector.register("projectDataService", ProjectDataServiceLib.ProjectDataService);
47+
testInjector.register("projectDataService", ProjectDataService);
4748
testInjector.register("prompter", {});
49+
testInjector.register("resources", ResourceLoader);
4850
testInjector.register("broccoliBuilder", {});
49-
testInjector.register("options", OptionsLib.Options);
50-
testInjector.register("errors", ErrorsLib.Errors);
51+
testInjector.register("options", Options);
52+
testInjector.register("errors", Errors);
5153
testInjector.register("logger", stubs.LoggerStub);
52-
testInjector.register("staticConfig", StaticConfigLib.StaticConfig);
54+
testInjector.register("staticConfig", StaticConfig);
5355
testInjector.register("hooksService", stubs.HooksServiceStub);
54-
testInjector.register("commandsService", CommandsServiceLib.CommandsService);
56+
testInjector.register("commandsService", CommandsService);
5557
testInjector.register("commandsServiceProvider", {
5658
registerDynamicSubCommands: () => {}
5759
});
58-
testInjector.register("hostInfo", HostInfoLib.HostInfo);
60+
testInjector.register("hostInfo", HostInfo);
5961
testInjector.register("lockfile", { });
60-
testInjector.register("projectHelper", ProjectHelperLib.ProjectHelper);
62+
testInjector.register("projectHelper", ProjectHelper);
6163

62-
testInjector.register("pluginsService", PluginsServiceLib.PluginsService);
64+
testInjector.register("pluginsService", PluginsService);
6365
testInjector.register("analyticsService", {
6466
trackException: () => { return (() => { }).future<void>()(); },
6567
checkConsent: () => { return (() => { }).future<void>()(); },
6668
trackFeature: () => { return (() => { }).future<void>()(); }
6769
});
68-
testInjector.register("projectFilesManager", ProjectFilesManagerLib.ProjectFilesManager);
70+
testInjector.register("projectFilesManager", ProjectFilesManager);
6971

7072
return testInjector;
7173
}
@@ -122,7 +124,7 @@ function addPluginWhenExpectingToFail(testInjector: IInjector, plugin: string, e
122124
mockBeginCommand(testInjector, "Exception: " + expectedErrorMessage);
123125

124126
isErrorThrown = false;
125-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
127+
let commandsService = testInjector.resolve(CommandsService);
126128
commandsService.tryExecuteCommand("plugin|add", [plugin]).wait();
127129

128130
assert.isTrue(isErrorThrown);
@@ -156,7 +158,7 @@ describe("Plugins service", () => {
156158
let testInjector: IInjector;
157159
beforeEach(() => {
158160
testInjector = createTestInjector();
159-
testInjector.registerCommand("plugin|add", AddPluginCommandLib.AddPluginCommand);
161+
testInjector.registerCommand("plugin|add", AddPluginCommand);
160162
});
161163

162164
describe("plugin add", () => {
@@ -190,7 +192,7 @@ describe("Plugins service", () => {
190192
mockBeginCommand(testInjector, "Exception: " + 'Plugin "plugin1" is already installed.');
191193

192194
isErrorThrown = false;
193-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
195+
let commandsService = testInjector.resolve(CommandsService);
194196
commandsService.tryExecuteCommand("plugin|add", [pluginName]).wait();
195197

196198
assert.isTrue(isErrorThrown);
@@ -263,7 +265,7 @@ describe("Plugins service", () => {
263265
}).future<IPluginData[]>()();
264266
}
265267

266-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
268+
let commandsService = testInjector.resolve(CommandsService);
267269
commandsService.tryExecuteCommand("plugin|add", [pluginName]).wait();
268270

269271
let fs = testInjector.resolve("fs");
@@ -301,7 +303,7 @@ describe("Plugins service", () => {
301303
}).future<IPluginData[]>()();
302304
}
303305

304-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
306+
let commandsService = testInjector.resolve(CommandsService);
305307
commandsService.tryExecuteCommand("plugin|add", [pluginName+"@1.0.0"]).wait();
306308

307309
let fs = testInjector.resolve("fs");
@@ -352,7 +354,7 @@ describe("Plugins service", () => {
352354
}).future<IPluginData[]>()();
353355
}
354356

355-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
357+
let commandsService = testInjector.resolve(CommandsService);
356358
commandsService.tryExecuteCommand("plugin|add", [pluginFolderPath]).wait();
357359

358360
// Assert that the all plugin's content is successfully added to node_modules folder
@@ -401,7 +403,7 @@ describe("Plugins service", () => {
401403
let options = testInjector.resolve("options");
402404
options.production = true;
403405

404-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
406+
let commandsService = testInjector.resolve(CommandsService);
405407
commandsService.tryExecuteCommand("plugin|add", [pluginFolderPath]).wait();
406408

407409
let nodeModulesFolderPath = path.join(projectFolder, "node_modules");
@@ -443,7 +445,7 @@ describe("Plugins service", () => {
443445
let options = testInjector.resolve("options");
444446
options.production = false;
445447

446-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
448+
let commandsService = testInjector.resolve(CommandsService);
447449
commandsService.tryExecuteCommand("plugin|add", [pluginFolderPath]).wait();
448450
});
449451
});
@@ -452,7 +454,7 @@ describe("Plugins service", () => {
452454
let testInjector: IInjector;
453455
beforeEach(() => {
454456
testInjector = createTestInjector();
455-
testInjector.registerCommand("plugin|add", AddPluginCommandLib.AddPluginCommand);
457+
testInjector.registerCommand("plugin|add", AddPluginCommand);
456458
});
457459
it("fails if the plugin contains incorrect xml", () => {
458460
let pluginName = "mySamplePlugin";
@@ -513,7 +515,7 @@ describe("Plugins service", () => {
513515
`\n@#[line:1,col:39].`;
514516
mockBeginCommand(testInjector, expectedErrorMessage);
515517

516-
let commandsService = testInjector.resolve(CommandsServiceLib.CommandsService);
518+
let commandsService = testInjector.resolve(CommandsService);
517519
commandsService.tryExecuteCommand("plugin|add", [pluginFolderPath]).wait();
518520
});
519521
it("merges AndroidManifest.xml and produces correct xml", () => {

0 commit comments

Comments
 (0)