Skip to content

Commit

Permalink
Migrate integration-tests/plugman_uninstall.spec.js to fs-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
raphinesse committed Sep 3, 2018
1 parent 6bae89d commit e656731
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions integration-tests/plugman_uninstall.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ var xmlHelpers = require('cordova-common').xmlHelpers;
var et = require('elementtree');
var fs = require('fs-extra');
var path = require('path');
var shell = require('shelljs');
var Q = require('q');
var rewire = require('rewire');
var spec = path.join(__dirname, '..', 'spec', 'plugman');
var srcProject = path.join(spec, 'projects', 'android');
var project = path.join(spec, 'projects', 'android_uninstall.test');
var project2 = path.join(spec, 'projects', 'android_uninstall.test2');
var project3 = path.join(spec, 'projects', 'android_uninstall.test3');
const projects = [project, project2, project3];

var plugins_dir = path.join(spec, 'plugins');
var plugins_install_dir = path.join(project, 'cordova', 'plugins');
Expand Down Expand Up @@ -83,10 +83,9 @@ describe('plugman uninstall start', function () {
});

it('Test 001 : plugman uninstall start', function () {
shell.rm('-rf', project, project2, project3);
shell.cp('-R', path.join(srcProject, '*'), project);
shell.cp('-R', path.join(srcProject, '*'), project2);
shell.cp('-R', path.join(srcProject, '*'), project3);
for (const p of projects) {
fs.copySync(srcProject, p);
}

return install('android', project, plugins['org.test.plugins.dummyplugin'])
.then(function (result) {
Expand All @@ -109,8 +108,8 @@ describe('uninstallPlatform', function () {
beforeEach(function () {
spyOn(actions.prototype, 'process').and.returnValue(Q());
spyOn(fs, 'writeFileSync').and.returnValue(true);
spyOn(shell, 'rm').and.returnValue(true);
spyOn(shell, 'cp').and.returnValue(true);
spyOn(fs, 'removeSync').and.returnValue(true);
spyOn(fs, 'copySync').and.returnValue(true);
});
describe('success', function () {

Expand Down Expand Up @@ -196,7 +195,7 @@ describe('uninstallPlugin', function () {

beforeEach(function () {
spyOn(fs, 'writeFileSync').and.returnValue(true);
spyOn(shell, 'rm').and.callFake(function (f, p) { rmstack.push(p); return true; });
spyOn(fs, 'removeSync').and.callFake(function (f, p) { rmstack.push(p); return true; });
rmstack = [];
emit = spyOn(events, 'emit');
});
Expand Down Expand Up @@ -259,7 +258,7 @@ describe('uninstall', function () {

beforeEach(function () {
spyOn(fs, 'writeFileSync').and.returnValue(true);
spyOn(shell, 'rm').and.returnValue(true);
spyOn(fs, 'removeSync').and.returnValue(true);
});

describe('failure', function () {
Expand All @@ -286,7 +285,9 @@ describe('uninstall', function () {
describe('end', function () {

afterEach(function () {
shell.rm('-rf', project, project2, project3);
for (const p of projects) {
fs.removeSync(p);
}
});

it('Test 013 : end', function () {
Expand Down

0 comments on commit e656731

Please sign in to comment.