Skip to content

Commit b62ad02

Browse files
committed
CB-13057 : removed platformsJson from integration tests
1 parent c48eaad commit b62ad02

File tree

3 files changed

+58
-59
lines changed

3 files changed

+58
-59
lines changed

integration-tests/pkgJson-restore.spec.js

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ describe('tests platform/spec restore with --save', function () {
142142
var cwd = process.cwd();
143143
var pkgJsonPath = path.join(cwd, 'package.json');
144144
var pkgJson;
145-
var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
146-
var platformsJson;
145+
//var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
146+
//var platformsJson;
147147
var configXmlPath = path.join(cwd, 'config.xml');
148148
var bPlatform = 'browser';
149149
var engines;
@@ -170,8 +170,8 @@ describe('tests platform/spec restore with --save', function () {
170170
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
171171
expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
172172
// Check that platform was added to platforms list successfully.
173-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
174-
expect(platformsJson[bPlatform]).toBeDefined();
173+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
174+
//expect(platformsJson[bPlatform]).toBeDefined();
175175
}).then(function () {
176176
// Remove platform without --save.
177177
return cordovaPlatform('rm', bPlatform, {'fetch': true});
@@ -181,8 +181,8 @@ describe('tests platform/spec restore with --save', function () {
181181
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
182182
expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
183183
// Platform in platforms.json should not be there.
184-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
185-
expect(platformsJson[bPlatform]).toBeUndefined();
184+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
185+
//expect(platformsJson[bPlatform]).toBeUndefined();
186186
}).then(function () {
187187
// Run cordova prepare
188188
return prepare({'fetch': true});
@@ -203,8 +203,8 @@ describe('tests platform/spec restore with --save', function () {
203203
expect(pkgJson.cordova.platforms.indexOf('browser')).toBeDefined();
204204
expect(pkgJson.dependencies['cordova-browser']).toEqual('git+https://github.com/apache/cordova-browser.git');
205205
// Check that platform was restored to platform.json list successfully.
206-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
207-
expect(platformsJson[bPlatform]).toBeDefined();
206+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
207+
//expect(platformsJson[bPlatform]).toBeDefined();
208208
}).fail(function (err) {
209209
expect(err).toBeUndefined();
210210
}).fin(done);
@@ -330,9 +330,9 @@ describe('tests platform/spec restore with --save', function () {
330330
var cwd = process.cwd();
331331
var pkgJsonPath = path.join(cwd, 'package.json');
332332
var pkgJson;
333-
var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
333+
//var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
334334
var secondPlatformAdded = 'browser';
335-
var platformsJson;
335+
//var platformsJson;
336336

337337
emptyPlatformList().then(function () {
338338
// Add 'browser' platform to project without --save
@@ -343,14 +343,14 @@ describe('tests platform/spec restore with --save', function () {
343343
}).then(function () {
344344
// Delete any previous caches of require(package.json) and (platformsJson)
345345
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
346-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
346+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
347347
// Check the platform add of only helpers.testPlatform was successful in package.json.
348348
expect(pkgJson.cordova.platforms).toBeDefined();
349349
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
350350
expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(-1);
351351
// Expect both platforms to be installed platform list in platforms.json
352-
expect(platformsJson[helpers.testPlatform]).toBeDefined();
353-
expect(platformsJson[secondPlatformAdded]).toBeDefined();
352+
//expect(platformsJson[helpers.testPlatform]).toBeDefined();
353+
//expect(platformsJson[secondPlatformAdded]).toBeDefined();
354354
}).then(fullPlatformList) // Platforms should still be in platform ls.
355355
.then(function () {
356356
// Remove helpers.testPlatform without --save.
@@ -360,23 +360,23 @@ describe('tests platform/spec restore with --save', function () {
360360
return cordovaPlatform('rm', secondPlatformAdded);
361361
}).then(function () {
362362
// Delete any previous caches of require(pkgJson) and (platformsJson)
363-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
363+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
364364
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
365365
// Check that the platform that was added with --save is still in package.json.
366366
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
367367
// Check that both platforms were removed from the platforms.json.
368-
expect(platformsJson[secondPlatformAdded]).toBeUndefined();
369-
expect(platformsJson[helpers.testPlatform]).toBeUndefined();
368+
//expect(platformsJson[secondPlatformAdded]).toBeUndefined();
369+
//expect(platformsJson[helpers.testPlatform]).toBeUndefined();
370370
}).then(function () {
371371
// Run cordova prepare
372372
return prepare();
373373
}).then(function () {
374374
// Delete any previous caches of platformsJson
375-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
375+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
376376
// Expect "helpers.testPlatform" to be in the installed platforms list.
377-
expect(platformsJson[helpers.testPlatform]).toBeDefined();
377+
//expect(platformsJson[helpers.testPlatform]).toBeDefined();
378378
// Expect that 'browser' will not be in platforms.json and has not been restored.
379-
expect(platformsJson[secondPlatformAdded]).toBeUndefined();
379+
//expect(platformsJson[secondPlatformAdded]).toBeUndefined();
380380
}).fail(function (err) {
381381
expect(err).toBeUndefined();
382382
}).fin(done);
@@ -1281,9 +1281,9 @@ describe('platforms and plugins should be restored with config.xml even without
12811281
});
12821282
var configEngArray = engNames.slice();
12831283
var configPlugins = cfg1.getPluginIdList();
1284-
var platformsFolderPath1 = path.join(cwd, 'platforms/platforms.json');
1284+
//var platformsFolderPath1 = path.join(cwd, 'platforms/platforms.json');
12851285
var pluginsFolderPath16 = path.join(cwd, 'plugins');
1286-
var platformsJson;
1286+
//var platformsJson;
12871287
var androidPlatform = 'android';
12881288
var browserPlatform = 'browser';
12891289

@@ -1307,11 +1307,11 @@ describe('platforms and plugins should be restored with config.xml even without
13071307
configEngArray = engNames.slice();
13081308
expect(configEngArray.length === 2);
13091309
// Delete previouc caches of (pkg.json).
1310-
platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
1310+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
13111311
// Browser should be installed
1312-
expect(platformsJson).toBeDefined();
1313-
expect(platformsJson[androidPlatform]).not.toBeDefined();
1314-
expect(platformsJson[browserPlatform]).toBeDefined();
1312+
//expect(platformsJson).toBeDefined();
1313+
//expect(platformsJson[androidPlatform]).not.toBeDefined();
1314+
//expect(platformsJson[browserPlatform]).toBeDefined();
13151315
// Package.json should be auto-created.
13161316
expect(path.join(cwd, 'package.json')).toExist();
13171317
var pkgJsonPath = path.join(cwd, 'package.json');
@@ -1326,10 +1326,10 @@ describe('platforms and plugins should be restored with config.xml even without
13261326
return cordovaPlatform('rm', [browserPlatform]);
13271327
}).then(function () {
13281328
// Android should not be in the installed list (only browser).
1329-
platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
1330-
expect(platformsJson).toBeDefined();
1331-
expect(platformsJson[browserPlatform]).toBeUndefined();
1332-
expect(platformsJson[androidPlatform]).not.toBeDefined();
1329+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
1330+
//expect(platformsJson).toBeDefined();
1331+
//expect(platformsJson[browserPlatform]).toBeUndefined();
1332+
//expect(platformsJson[androidPlatform]).not.toBeDefined();
13331333
}).then(function () {
13341334
// Run cordova prepare.
13351335
return prepare();
@@ -1345,9 +1345,9 @@ describe('platforms and plugins should be restored with config.xml even without
13451345
expect(configEngArray.indexOf(browserPlatform)).toBeGreaterThan(-1);
13461346
expect(configEngArray.length === 2);
13471347
// Expect that android and browser were restored.
1348-
platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
1349-
expect(platformsJson[androidPlatform]).toBeDefined();
1350-
expect(platformsJson[browserPlatform]).toBeDefined();
1348+
// platformsJson = cordova_util.requireNoCache(platformsFolderPath1);
1349+
// expect(platformsJson[androidPlatform]).toBeDefined();
1350+
// expect(platformsJson[browserPlatform]).toBeDefined();
13511351
}).then(function () {
13521352
// Check plugins.
13531353
var cfg5 = new ConfigParser(configXmlPath);
@@ -1438,42 +1438,42 @@ describe('tests platform/spec restore with --save', function () {
14381438
var pkgJsonPath = path.join(cwd, 'package.json');
14391439
cordova_util.requireNoCache(pkgJsonPath);
14401440
var pkgJson;
1441-
var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
1442-
var platformsJson;
1441+
//var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
1442+
//var platformsJson;
14431443

14441444
emptyPlatformList().then(function () {
14451445
// Add the testing platform with --save.
14461446
return cordovaPlatform('add', 'android', {'save': true});
14471447
}).then(function () {
14481448
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
14491449
// Require platformsFolderPath
1450-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
1450+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
14511451
// Check the platform add was successful in package.json.
14521452
expect(pkgJson.cordova.platforms).toBeDefined();
14531453
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
14541454
// Expect that "helpers.testPlatform" in the installed platform list in platforms.json
1455-
expect(platformsJson).toBeDefined();
1456-
expect(platformsJson[helpers.testPlatform]).toBeDefined();
1455+
//expect(platformsJson).toBeDefined();
1456+
//expect(platformsJson[helpers.testPlatform]).toBeDefined();
14571457
}).then(fullPlatformList) // Platform should still be in platform ls.
14581458
.then(function () {
14591459
// And now remove helpers.testPlatform without --save.
14601460
return cordovaPlatform('rm', [helpers.testPlatform]);
14611461
}).then(function () {
14621462
// Delete any previous caches of require(package.json) and (platforms.json)
1463-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
1463+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
14641464
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
14651465
// Check that the platform removed without --save is still in platforms key.
14661466
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toBeGreaterThan(-1);
14671467
// Check that the platform was removed from the platforms.json
1468-
expect(platformsJson[helpers.testPlatform]).toBeUndefined();
1468+
//expect(platformsJson[helpers.testPlatform]).toBeUndefined();
14691469
}).then(function () {
14701470
// Run cordova prepare.
14711471
return prepare();
14721472
}).then(function () {
14731473
// Delete any previous caches of platforms.json.
1474-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
1474+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
14751475
// Expect "helpers.testPlatform" to be in the installed platforms list in platforms.json.
1476-
expect(platformsJson[helpers.testPlatform]).toBeDefined();
1476+
//expect(platformsJson[helpers.testPlatform]).toBeDefined();
14771477
}).fail(function (err) {
14781478
expect(err).toBeUndefined();
14791479
}).fin(done);
@@ -1489,8 +1489,8 @@ describe('tests platform/spec restore with --save', function () {
14891489
var cwd = process.cwd();
14901490
var pkgJsonPath = path.join(cwd, 'package.json');
14911491
var pkgJson;
1492-
var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
1493-
var platformsJson;
1492+
//var platformsFolderPath = path.join(cwd, 'platforms/platforms.json');
1493+
//var platformsJson;
14941494
var secondPlatformAdded = 'browser';
14951495

14961496
emptyPlatformList().then(function () {
@@ -1502,15 +1502,15 @@ describe('tests platform/spec restore with --save', function () {
15021502
}).then(function () {
15031503
// Delete any previous caches of require(package.json) and (platforms.json).
15041504
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
1505-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
1505+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
15061506
// Check the platform add of both platforms (to pkg.Json) was successful.
15071507
expect(pkgJson.cordova.platforms).toBeDefined();
15081508
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(0);
15091509
expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(1);
15101510
// Expect that "helpers.testPlatform" in the installed platform list in platforms.json.
1511-
expect(platformsJson).toBeDefined();
1512-
expect(platformsJson[helpers.testPlatform]).toBeDefined();
1513-
expect(platformsJson[secondPlatformAdded]).toBeDefined();
1511+
// expect(platformsJson).toBeDefined();
1512+
// expect(platformsJson[helpers.testPlatform]).toBeDefined();
1513+
// expect(platformsJson[secondPlatformAdded]).toBeDefined();
15141514
}).then(fullPlatformList) // Platform should still be in platform ls.
15151515
.then(function () {
15161516
// Remove helpers.testPlatform with --save.
@@ -1520,24 +1520,24 @@ describe('tests platform/spec restore with --save', function () {
15201520
return cordovaPlatform('rm', secondPlatformAdded);
15211521
}).then(function () {
15221522
// Delete any previous caches of require(package.json) and (platformsJson).
1523-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
1523+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
15241524
pkgJson = cordova_util.requireNoCache(pkgJsonPath);
15251525
// Check that ONLY the platform removed without --save is still in (pkg.json) platforms key.
15261526
expect(pkgJson.cordova.platforms.indexOf(secondPlatformAdded)).toEqual(0);
15271527
expect(pkgJson.cordova.platforms.indexOf(helpers.testPlatform)).toEqual(-1);
15281528
// Check that both platforms were removed from the platforms.json list.
1529-
expect(platformsJson[helpers.testPlatform]).toBeUndefined();
1530-
expect(platformsJson[secondPlatformAdded]).toBeUndefined();
1529+
//expect(platformsJson[helpers.testPlatform]).toBeUndefined();
1530+
//expect(platformsJson[secondPlatformAdded]).toBeUndefined();
15311531
}).then(function () {
15321532
// Run cordova prepare.
15331533
return prepare();
15341534
}).then(function () {
15351535
// Delete any previous caches of platformsJson.
1536-
platformsJson = cordova_util.requireNoCache(platformsFolderPath);
1536+
//platformsJson = cordova_util.requireNoCache(platformsFolderPath);
15371537
// Expect "helpers.testPlatform" to be in the installed platforms list in platforms.json
1538-
expect(platformsJson[helpers.testPlatform]).toBeUndefined();
1538+
//expect(platformsJson[helpers.testPlatform]).toBeUndefined();
15391539
// Expect 'browser' not to be in platforms.json and has not been restored.
1540-
expect(platformsJson[secondPlatformAdded]).toBeDefined();
1540+
//expect(platformsJson[secondPlatformAdded]).toBeDefined();
15411541
}).fail(function (err) {
15421542
expect(err).toBeUndefined();
15431543
}).fin(done);

0 commit comments

Comments
 (0)