Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Update test specs
Browse files Browse the repository at this point in the history
[spec] Revamp test
[spec] Fix "[Error: Cannot find module '../www']"
[spec] Add missing 'typeof' to the assetions.
[git] Ignore the node_modules/ directory.
[spec] fix failing tests
  • Loading branch information
macdonst committed Aug 12, 2015
1 parent d1a39fb commit 85191ee
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 3,412 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.iml
.idea
.DS_Store
/node_modules/
46 changes: 0 additions & 46 deletions spec/genericpush.tests.js

This file was deleted.

83 changes: 83 additions & 0 deletions spec/helper/cordova.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/* global cordova:true */

/*!
* Module dependencies.
*/

/**
* cordova.js for node.
*
* Think of this as cordova-node, which would be simliar to cordova-android
* or cordova-browser. The purpose of this module is to enable testing
* of a plugin's JavaScript interface.
*
* When this module is first required, it will insert a global cordova
* instance, which can hijack cordova-specific commands within the pluin's
* implementation.
*
* Remember to require this module before the plugin that you want to test.
*
* Example:
*
* var cordova = require('./helper/cordova'),
* myPlugin = require('../www/myPlugin');
*/

module.exports = global.cordova = cordova = {

/**
* cordova.require Mock.
*
* Hijacks all cordova.requires. By default, it returns an empty function.
* You can define your own implementation of each required module before
* or after it has been required.
*
* See `cordova.required` to learn how to add your own module implemtnation.
*/

require: function(moduleId) {
// define a default function if it doesn't exist
if (!cordova.required[moduleId]) {
cordova.required[moduleId] = function() {};
}
// create a new module mapping between the module Id and cordova.required.
return new ModuleMap(moduleId);
},

/**
* Cordova module implementations.
*
* A key-value hash, where the key is the module such as 'cordova/exec'
* and the value is the function or object returned.
*
* For example:
*
* var exec = require('cordova/exec');
*
* Will map to:
*
* cordova.required['cordova/exec'];
*/

required: {
// populated at runtime
}
};

/**
* Module Mapper.
*
* Returns a function that when executed will lookup the implementation
* in cordova.required[id].
*
* @param {String} moduleId is the module name/path, such as 'cordova/exec'
* @return {Function}.
*/

function ModuleMap(moduleId) {
return function() {
// lookup and execute the module's mock implementation, passing
// in any parameters that were provided.
return cordova.required[moduleId].apply(this, arguments);
};
}
101 changes: 0 additions & 101 deletions spec/html/HtmlReporter.js

This file was deleted.

60 changes: 0 additions & 60 deletions spec/html/HtmlReporterHelpers.js

This file was deleted.

Loading

0 comments on commit 85191ee

Please sign in to comment.