Skip to content

Commit

Permalink
Factor out project creation
Browse files Browse the repository at this point in the history
  • Loading branch information
raphinesse committed Sep 6, 2018
1 parent 1142d3a commit 5ea614f
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions integration-tests/platform.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ describe('cordova/platform', () => {
nodeModulesDir = path.join(project, 'node_modules');
testPlatformDir = path.join(platformsDir, testPlatform);
process.chdir(tmpDir);
return cordova.create(path.basename(project))
.then(() => process.chdir(project));
});

afterEach(() => {
Expand All @@ -55,11 +57,11 @@ describe('cordova/platform', () => {
describe('platform end-to-end', () => {

it('Test 001 : should successfully run', () => {
return cordova.create(path.basename(project))
// Check there are no platforms yet.
expect(installedPlatforms()).toEqual([]);

return Promise.resolve()
.then(() => {
process.chdir(project);
// Check there are no platforms yet.
expect(installedPlatforms()).toEqual([]);
// Add the testing platform.
return cordova.platform('add', [testPlatform]);
})
Expand Down Expand Up @@ -92,9 +94,8 @@ describe('cordova/platform', () => {
});

it('Test 002 : should install plugins correctly while adding platform', () => {
return cordova.create(path.basename(project))
return Promise.resolve()
.then(() => {
process.chdir(project);
return cordova.plugin('add', path.join(pluginFixturesDir, 'test'));
})
.then(() => {
Expand All @@ -121,9 +122,8 @@ describe('cordova/platform', () => {
addHelper.__set__({ require: requireFake });
platform.__set__({ addHelper });

return cordova.create(path.basename(project))
return Promise.resolve()
.then(() => {
process.chdir(project);
return cordova.plugin('add', path.join(pluginFixturesDir, 'test'));
})
.then(() => {
Expand All @@ -139,9 +139,8 @@ describe('cordova/platform', () => {
describe('platform add plugin rm end-to-end', () => {

it('Test 006 : should remove dependency when removing parent plugin', () => {
return cordova.create(path.basename(project))
return Promise.resolve()
.then(() => {
process.chdir(project);
return cordova.platform('add', 'browser@latest');
})
.then(() => {
Expand All @@ -167,10 +166,8 @@ describe('cordova/platform', () => {
describe('platform add and remove --fetch', () => {

it('Test 007 : should add and remove platform from node_modules directory', () => {

return cordova.create(path.basename(project))
return Promise.resolve()
.then(() => {
process.chdir(project);
return cordova.platform('add', 'browser', {'save': true});
})
.then(() => {
Expand Down Expand Up @@ -198,10 +195,8 @@ describe('cordova/platform', () => {
describe('plugin add and rm end-to-end --fetch', () => {

it('Test 008 : should remove dependency when removing parent plugin', () => {

return cordova.create(path.basename(project))
return Promise.resolve()
.then(() => {
process.chdir(project);
return cordova.platform('add', 'browser');
})
.then(() => {
Expand Down Expand Up @@ -233,9 +228,8 @@ describe('cordova/platform', () => {
describe('non-core platform add and rm end-to-end --fetch', () => {

it('Test 009 : should add and remove 3rd party platforms', () => {
return cordova.create(path.basename(project))
return Promise.resolve()
.then(() => {
process.chdir(project);
// add cordova-android instead of android
return cordova.platform('add', 'cordova-android');
})
Expand Down

0 comments on commit 5ea614f

Please sign in to comment.