1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-22 08:52:15 -05:00
mail/test/main.js
2014-12-18 15:25:18 +01:00

62 lines
1.4 KiB
JavaScript

'use strict';
//
// Polyfills
//
// Mozilla bind polyfill because phantomjs is stupid
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
FNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof FNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
};
FNOP.prototype = this.prototype;
fBound.prototype = new FNOP();
return fBound;
};
}
//
// Test setup
//
chai.config.includeStack = true;
// set worker path for tests
require('../src/js/app-config').config.workerPath = '../lib';
var axe = require('axe-logger');
axe.removeAppender(axe.defaultAppender);
// include angular modules
require('../src/js/app-config');
require('../src/js/util');
require('../src/js/crypto');
require('../src/js/service');
require('../src/js/email');
//
// Global mocks
//
window.resolves = function(val) {
return new Promise(function(res) {
res(val);
});
};
window.rejects = function(val) {
return new Promise(function(res, rej) {
rej(val);
});
};