Skip to content
Permalink
Browse files
Remove unused test helpers
  • Loading branch information
raphinesse committed May 13, 2018
1 parent 9dc360d commit e4d99a4bdbd9be50b271fe62da002e5beebffad3
Showing 1 changed file with 4 additions and 116 deletions.
@@ -17,23 +17,10 @@
under the License.
*/

var path = require('path'),
fs = require('fs'),
shell = require('shelljs'),
os = require('os'),
ConfigParser = require('cordova-common').ConfigParser;

// Just use Android everywhere; we're mocking out any calls to the `android` binary.
module.exports.testPlatform = 'android';

function getConfigPath (dir) {
// if path ends with 'config.xml', return it
if (dir.indexOf('config.xml') == dir.length - 10) {
return dir;
}
// otherwise, add 'config.xml' to the end of it
return path.join(dir, 'config.xml');
}
var path = require('path');
var fs = require('fs');
var shell = require('shelljs');
var os = require('os');

module.exports.tmpDir = function (subdir) {
var dir = path.join(os.tmpdir(), 'e2e-test');
@@ -47,105 +34,6 @@ module.exports.tmpDir = function (subdir) {
return dir;
};

// Returns the platform that should be used for testing on this host platform.
/*
var host = os.platform();
if (host.match(/win/)) {
module.exports.testPlatform = 'wp8';
} else if (host.match(/darwin/)) {
module.exports.testPlatform = 'ios';
} else {
module.exports.testPlatform = 'android';
}
*/

module.exports.setEngineSpec = function (appPath, engine, spec) {
appPath = getConfigPath(appPath);
var parser = new ConfigParser(appPath);

parser.removeEngine(engine);
parser.addEngine(engine, spec);
parser.write();
};

module.exports.getEngineSpec = function (appPath, engine) {
appPath = getConfigPath(appPath);
var parser = new ConfigParser(appPath),
engines = parser.getEngines();

for (var i = 0; i < engines.length; i++) {
if (engines[i].name === module.exports.testPlatform) {
return engines[i].spec;
}
}
return null;
};

module.exports.removeEngine = function (appPath, engine) {
appPath = getConfigPath(appPath);
var parser = new ConfigParser(appPath);

parser.removeEngine(module.exports.testPlatform);
parser.write();
};

module.exports.setPluginSpec = function (appPath, plugin, spec) {
appPath = getConfigPath(appPath);
var parser = new ConfigParser(appPath),
p = parser.getPlugin(plugin),
variables = [];

if (p) {
parser.removePlugin(p.name);
if (p.variables.length && p.variables.length > 0) {
variables = p.variables;
}
}

parser.addPlugin({ 'name': plugin, 'spec': spec }, variables);
parser.write();
};

module.exports.getPluginSpec = function (appPath, plugin) {
appPath = getConfigPath(appPath);
var parser = new ConfigParser(appPath),
p = parser.getPlugin(plugin);

if (p) {
return p.spec;
}
return null;
};

module.exports.getPluginVariable = function (appPath, plugin, variable) {
appPath = getConfigPath(appPath);
var parser = new ConfigParser(appPath),
p = parser.getPlugin(plugin);

if (p && p.variables) {
return p.variables[variable];
}
return null;
};

module.exports.removePlugin = function (appPath, plugin) {
appPath = getConfigPath(appPath);
var parser = new ConfigParser(appPath);

parser.removePlugin(plugin);
parser.write();
};

module.exports.getConfigContent = function (appPath) {
var configFile = path.join(appPath, 'config.xml');
return fs.readFileSync(configFile, 'utf-8');
};

module.exports.writeConfigContent = function (appPath, configContent) {
var configFile = path.join(appPath, 'config.xml');
fs.writeFileSync(configFile, configContent, 'utf-8');
};

// Add the toExist matcher.
beforeEach(function () {
jasmine.addMatchers({

0 comments on commit e4d99a4

Please sign in to comment.