1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var copy = require("./copy");
|
4 | var config = require("./util/config");
|
5 | describe('copy task', function () {
|
6 | describe('copyConfigToWatchConfig', function () {
|
7 | it('should convert to watch config format', function () {
|
8 |
|
9 | var context = {};
|
10 | var configFile = 'configFile';
|
11 | var sampleConfig = {
|
12 | copyAssets: {
|
13 | src: ['{{SRC}}/assets/**/*'],
|
14 | dest: '{{WWW}}/assets'
|
15 | },
|
16 | copyIndexContent: {
|
17 | src: ['{{SRC}}/index.html', '{{SRC}}/manifest.json', '{{SRC}}/service-worker.js'],
|
18 | dest: '{{WWW}}'
|
19 | },
|
20 | copyFonts: {
|
21 | src: ['{{ROOT}}/node_modules/ionicons/dist/fonts/**/*', '{{ROOT}}/node_modules/ionic-angular/fonts/**/*'],
|
22 | dest: '{{WWW}}/assets/fonts'
|
23 | },
|
24 | copyPolyfills: {
|
25 | src: ["{{ROOT}}/node_modules/ionic-angular/polyfills/" + process.env.POLLYFILL_NAME + ".js"],
|
26 | dest: '{{BUILD}}'
|
27 | },
|
28 | someOtherOption: {
|
29 | src: ['{{ROOT}}/whatever'],
|
30 | dest: '{{BUILD}}'
|
31 | }
|
32 | };
|
33 | var combinedSource = [];
|
34 | Object.keys(sampleConfig).forEach(function (entry) { return combinedSource = combinedSource.concat(sampleConfig[entry].src); });
|
35 | spyOn(config, config.generateContext.name).and.returnValue(context);
|
36 | spyOn(config, config.getUserConfigFile.name).and.returnValue(configFile);
|
37 | spyOn(config, config.fillConfigDefaults.name).and.returnValue(sampleConfig);
|
38 |
|
39 | var result = copy.copyConfigToWatchConfig(null);
|
40 |
|
41 | expect(config.generateContext).toHaveBeenCalledWith(null);
|
42 | expect(config.getUserConfigFile).toHaveBeenCalledWith(context, copy.taskInfo, '');
|
43 | expect(config.fillConfigDefaults).toHaveBeenCalledWith(configFile, copy.taskInfo.defaultConfigFile);
|
44 | result.paths.forEach(function (glob) {
|
45 | expect(combinedSource.indexOf(glob)).not.toEqual(-1);
|
46 | });
|
47 | expect(result.callback).toBeDefined();
|
48 | expect(result.options).toBeDefined();
|
49 | });
|
50 | });
|
51 | });
|