Skip to content
Permalink
Browse files
Drop unused test helpers (#214)
* Remove unused module mockxhr

* Remove unnecessary test utils

* Remove unused placeholders

* Inline testmodule fixture

* Move test-platform modules to test/
  • Loading branch information
raphinesse committed Oct 13, 2019
1 parent 74fdba8 commit b4bff14fa9e39af117478d103e7cac86724c1009
Showing 10 changed files with 18 additions and 258 deletions.
@@ -30,7 +30,6 @@ function each (objects, func, context) {
}

function clobber (obj, key, value) {
exports.replaceHookForTesting(obj, key);
var needsProperty = false;
try {
obj[key] = value;
@@ -130,4 +129,3 @@ exports.buildIntoAndMerge = function (objects, target) {
};
exports.recursiveMerge = recursiveMerge;
exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
exports.replaceHookForTesting = function () {};

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -27,7 +27,7 @@ function buildCordovaJsTestBundle (bundlePath) {
extraModules: collectTestBuildModules(),
preprocess (f) {
// Do not instrument our test dummies
if (f.path.includes('src/legacy-exec/test/')) return f;
if (f.path.includes('/test/test-platform-modules/')) return f;

const contents = instrumenter.instrumentSync(f.contents, f.path);
return Object.assign({}, f, { contents });
@@ -51,6 +51,6 @@ function collectTestBuildModules () {
});

// Finally, add modules provided by test platform
const testModulesPath = path.join(__dirname, '../src/legacy-exec/test');
const testModulesPath = path.join(__dirname, 'test-platform-modules');
return Object.assign(...platformModules, collectModules(testModulesPath));
}
File renamed without changes.
@@ -19,4 +19,7 @@
*
*/

throw new Error('should have been replaced at build time with platform implementation');
module.exports = {
id: 'test platform',
bootstrap: function () {}
};
@@ -20,11 +20,20 @@

describe('modulemapper', function () {
var modulemapper = cordova.require('cordova/modulemapper');
var testmodule = cordova.require('cordova/test/testmodule');
var utils = cordova.require('cordova/utils');
var context;
var context, testmodule;

beforeEach(function () {
testmodule = {
func: function () {},
num: 2,
obj: { str: 'hello' },
subObj: { str: 'testSubObj' }
};
cordova.define('cordova/test/testmodule', (r, e, module) => {
module.exports = testmodule;
});

function TestClass () {}
TestClass.prototype.method1 = function () { return 'orig'; };

@@ -39,6 +48,7 @@ describe('modulemapper', function () {

afterEach(function () {
modulemapper.reset();
cordova.define.remove('cordova/test/testmodule');
});

it('Test#001 : should throw in module does not exist', function () {

0 comments on commit b4bff14

Please sign in to comment.