1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-21 23:08:50 -05:00
mail/test/main.js

66 lines
1.5 KiB
JavaScript
Raw Normal View History

2014-10-09 10:51:39 -04:00
'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;
};
}
2014-11-21 06:13:06 -05:00
//
// Test setup
//
2014-11-26 07:43:10 -05:00
chai.config.includeStack = true;
2014-10-09 10:51:39 -04:00
// set worker path for tests
2014-11-05 08:27:21 -05:00
require('../src/js/app-config').config.workerPath = '../lib';
var axe = require('axe-logger');
2014-11-21 06:13:06 -05:00
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
//
2014-12-17 16:41:57 -05:00
window.qMock = function(res, rej) {
return new Promise(res, rej);
};
2014-12-10 11:39:40 -05:00
window.resolves = function(val) {
return new Promise(function(res) {
res(val);
});
};
window.rejects = function(val) {
return new Promise(function(res, rej) {
rej(val);
});
};