1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-25 18:32:20 -05:00

WIP add unit tests

This commit is contained in:
Felix Hammerl 2014-10-07 20:32:23 +02:00
parent c36cd069e0
commit 9bfda73969
40 changed files with 9527 additions and 9675 deletions

2
.gitignore vendored
View File

@ -8,3 +8,5 @@ dist/
release/
test/integration/src/
.elasticbeanstalk/
test/unit/index.js
test/unit/index.js.map

View File

@ -18,19 +18,18 @@
"unused": true,
"predef": [
"console",
"Notification",
"importScripts",
"process",
"Event",
"chrome",
"define",
"self",
"describe",
"it",
"chai",
"console",
"process",
"chrome",
"Notification",
"Event",
"sinon",
"mocha",
"chai",
"expect",
"describe",
"it",
"before",
"beforeEach",
"after",

View File

@ -1,6 +1,8 @@
module.exports = function(grunt) {
'use strict';
require('time-grunt')(grunt);
var version = grunt.option('release'),
zipName = (version) ? version : 'DEV';
@ -24,7 +26,7 @@ module.exports = function(grunt) {
},
jshint: {
all: ['Gruntfile.js', 'src/*.js', 'src/js/**/*.js', 'test/unit/*.js', 'test/integration/*.js'],
all: ['Gruntfile.js', 'src/*.js', 'src/js/**/*.js', 'test/unit/*-test.js', 'test/integration/*.js'],
options: {
jshintrc: '.jshintrc'
}
@ -109,15 +111,21 @@ module.exports = function(grunt) {
'dist/js/app.min.js': ['src/js/app.js']
},
options: {
external: ['node-forge', 'net', 'tls'] // common.js apis not required at build time
external: []
}
},
/* TODO:
tls-worker: {},
unitTest: {
files: {
'test/unit/index.js': ['test/unit/*-test.js']
},
options: {
external: []
}
},
/*
TODO:
mailreader-worker: {},
pbkdf2-worker: {},
unitTest: {},
unitTest: {},
integrationTest: {}
*/
},
@ -126,6 +134,7 @@ module.exports = function(grunt) {
all: {
files: {
'dist/js/app.min.js': [
'src/lib/openpgp/openpgp.js',
'src/lib/underscore/underscore-min.js',
'node_modules/jquery/dist/jquery.min.js',
'src/lib/angular/angular.min.js',
@ -142,6 +151,28 @@ module.exports = function(grunt) {
]
}
},
unitTest: {
files: {
'test/unit/index.js': [
'src/lib/underscore/underscore-min.js',
'node_modules/jquery/dist/jquery.min.js',
'src/lib/openpgp/openpgp.js',
'src/lib/angular/angular.min.js',
'node_modules/angular-mocks/angular-mocks.js',
'src/lib/angular/angular-route.min.js',
'src/lib/angular/angular-animate.min.js',
'src/lib/ngtagsinput/ng-tags-input.min.js',
'src/lib/fastclick/fastclick.js',
'node_modules/ng-infinite-scroll/build/ng-infinite-scroll.min.js',
'src/lib/lawnchair/lawnchair-git.js',
'src/lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js',
'src/lib/lawnchair/lawnchair-adapter-indexed-db-git.js',
'node_modules/dompurify/purify.js',
'test/lib/angular-mocks.js',
'test/unit/index.js'
]
}
},
options: {
banner: '/*! Copyright © <%= grunt.template.today("yyyy") %>, Whiteout Networks GmbH.*/\n'
}
@ -152,7 +183,7 @@ module.exports = function(grunt) {
expand: true,
flatten: true,
cwd: 'node_modules/',
src: ['requirejs/require.js', 'mocha/mocha.css', 'mocha/mocha.js', 'chai/chai.js', 'sinon/pkg/sinon.js', 'angularjs/src/ngMock/angular-mocks.js', 'browsercrow/src/*.js', 'browsersmtp/src/*.js'],
src: ['mocha/mocha.css', 'mocha/mocha.js', 'chai/chai.js', 'sinon/pkg/sinon.js', 'browsercrow/src/*.js', 'browsersmtp/src/*.js'],
dest: 'test/lib/'
},
font: {

View File

@ -46,6 +46,7 @@
"wo-smtpclient": "^0.3.8"
},
"devDependencies": {
"angular-mocks": "^1.2.25",
"angularjs": "https://github.com/whiteout-io/angular.js/tarball/npm-version",
"browsercrow": "https://github.com/whiteout-io/browsercrow/tarball/master",
"browsersmtp": "https://github.com/whiteout-io/browsersmtp/tarball/master",
@ -65,6 +66,7 @@
"grunt-manifest": "^0.4.0",
"grunt-mocha": "~0.4.1",
"mocha": "~1.13.0",
"sinon": "~1.7.3"
"sinon": "~1.7.3",
"time-grunt": "^1.0.0"
}
}

View File

@ -1,14 +1,11 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
AccountCtrl = require('js/controller/account'),
PGP = require('js/crypto/pgp'),
dl = require('js/util/download'),
appController = require('js/app-controller'),
KeychainDAO = require('js/dao/keychain-dao');
var mocks = angular.mocks,
AccountCtrl = require('../../src/js/controller/account'),
PGP = require('../../src/js/crypto/pgp'),
dl = require('../../src/js/util/download'),
appController = require('../../src/js/app-controller'),
KeychainDAO = require('../../src/js/dao/keychain-dao');
describe('Account Controller unit test', function() {
var scope, accountCtrl,
@ -98,4 +95,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,13 +1,10 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
AddAccountCtrl = require('js/controller/add-account'),
Auth = require('js/bo/auth'),
AdminDao = require('js/dao/admin-dao'),
appController = require('js/app-controller');
var mocks = angular.mocks,
AddAccountCtrl = require('../../src/js/controller/add-account'),
Auth = require('../../src/js/bo/auth'),
AdminDao = require('../../src/js/dao/admin-dao'),
appController = require('../../src/js/app-controller');
describe('Add Account Controller unit test', function() {
var scope, location, ctrl, authStub, origAuth, adminStub;
@ -213,4 +210,3 @@ define(function(require) {
});
});
});

View File

@ -1,9 +1,7 @@
define(function(require) {
'use strict';
var RestDAO = require('js/dao/rest-dao'),
AdminDAO = require('js/dao/admin-dao'),
expect = chai.expect;
var RestDAO = require('../../src/js/dao/rest-dao'),
AdminDAO = require('../../src/js/dao/admin-dao');
describe('Admin DAO unit tests', function() {
@ -142,5 +140,3 @@ define(function(require) {
});
});
});

View File

@ -1,13 +1,11 @@
define(function(require) {
'use strict';
var controller = require('js/app-controller'),
EmailDAO = require('js/dao/email-dao'),
OutboxBO = require('js/bo/outbox'),
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
UpdateHandler = require('js/util/update/update-handler'),
Auth = require('js/bo/auth'),
expect = chai.expect;
var controller = require('../../src/js/app-controller'),
EmailDAO = require('../../src/js/dao/email-dao'),
OutboxBO = require('../../src/js/bo/outbox'),
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'),
UpdateHandler = require('../../src/js/util/update/update-handler'),
Auth = require('../../src/js/bo/auth');
describe('App Controller unit tests', function() {
var emailDaoStub, outboxStub, updateHandlerStub, appConfigStoreStub, devicestorageStub, isOnlineStub, authStub;
@ -210,4 +208,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,11 +1,9 @@
define(function(require) {
'use strict';
var Auth = require('js/bo/auth'),
OAuth = require('js/util/oauth'),
PGP = require('js/crypto/pgp'),
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
expect = chai.expect;
var Auth = require('../../src/js/bo/auth'),
OAuth = require('../../src/js/util/oauth'),
PGP = require('../../src/js/crypto/pgp'),
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
describe('Auth unit tests', function() {
// Constancts
@ -375,4 +373,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,8 +1,6 @@
define(function(require) {
'use strict';
var btnHandler = require('js/util/backbutton-handler'),
expect = chai.expect;
var btnHandler = require('../../src/js/util/backbutton-handler');
describe('Backbutton Handler', function() {
chai.Assertion.includeStack = true;
@ -64,4 +62,3 @@ define(function(require) {
document.dispatchEvent(event);
});
});
});

View File

@ -1,12 +1,10 @@
define(function(require) {
'use strict';
var ConnectionDoctor = require('js/util/connection-doctor'),
TCPSocket = require('tcp-socket'),
var TCPSocket = require('tcp-socket'),
ImapClient = require('imap-client'),
SmtpClient = require('smtpclient'),
cfg = require('js/app-config').config,
expect = chai.expect;
SmtpClient = require('wo-smtpclient'),
ConnectionDoctor = require('../../src/js/util/connection-doctor'),
cfg = require('../../src/js/app-config').config;
describe('Connection Doctor', function() {
var doctor;
@ -411,4 +409,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,13 +1,10 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
ContactsCtrl = require('js/controller/contacts'),
appController = require('js/app-controller'),
KeychainDAO = require('js/dao/keychain-dao'),
PGP = require('js/crypto/pgp');
var mocks = angular.mocks,
ContactsCtrl = require('../../src/js/controller/contacts'),
appController = require('../../src/js/app-controller'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
PGP = require('../../src/js/crypto/pgp');
describe('Contacts Controller unit test', function() {
var scope, contactsCtrl,
@ -187,4 +184,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,10 +1,8 @@
define(function(require) {
'use strict';
var Crypto = require('js/crypto/crypto'),
util = require('js/crypto/util'),
config = require('js/app-config').config,
expect = chai.expect;
var Crypto = require('../../src/js/crypto/crypto'),
config = require('../../src/js/app-config').config,
util = require('crypto-lib').util;
describe('Crypto unit tests', function() {
this.timeout(20000);
@ -55,4 +53,3 @@ define(function(require) {
});
});
});

View File

@ -1,9 +1,7 @@
define(function(require) {
'use strict';
var LawnchairDAO = require('js/dao/lawnchair-dao'),
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
expect = chai.expect;
var LawnchairDAO = require('../../src/js/dao/lawnchair-dao'),
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
var testUser = 'test@example.com';
@ -101,5 +99,3 @@ define(function(require) {
});
});
});

View File

@ -1,10 +1,7 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
DialogCtrl = require('js/controller/dialog');
var mocks = angular.mocks,
DialogCtrl = require('../../src/js/controller/dialog');
describe('Dialog Controller unit test', function() {
var scope, dialogCtrl;
@ -47,4 +44,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,16 +1,14 @@
define(function(require) {
'use strict';
var EmailDAO = require('js/dao/email-dao'),
KeychainDAO = require('js/dao/keychain-dao'),
var mailreader = require('mailreader'),
ImapClient = require('imap-client'),
PgpMailer = require('pgpmailer'),
PgpBuilder = require('pgpbuilder'),
PGP = require('js/crypto/pgp'),
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
mailreader = require('mailreader'),
cfg = require('js/app-config').config,
expect = chai.expect;
cfg = require('../../src/js/app-config').config,
EmailDAO = require('../../src/js/dao/email-dao'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
PGP = require('../../src/js/crypto/pgp'),
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
describe('Email DAO unit tests', function() {
@ -2301,4 +2299,3 @@ define(function(require) {
});
});
});
});

View File

@ -9,11 +9,70 @@
<body>
<div id="mocha"></div>
<script>
//
// Polyfills
//
(function() {
'use strict';
// 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;
};
}
// a warm round of applause for phantomjs for missing events
(function() {
function CustomEvent(event, params) {
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
})();
})();
</script>
<script src="../lib/chai.js"></script>
<script src="../lib/sinon.js"></script>
<script src="../lib/mocha.js"></script>
<script src="../lib/sinon.js"></script>
<script data-main="main.js" src="../../src/lib/require.js"></script>
<script>
window.expect = chai.expect;
mocha.setup('bdd');
</script>
<script src="index.js"></script>
<script>
mocha.checkLeaks();
mocha.globals([]);
mocha.run();
</script>
</body>
</html>

View File

@ -1,9 +1,7 @@
define(function(require) {
'use strict';
var RestDAO = require('js/dao/rest-dao'),
InvitationDAO = require('js/dao/invitation-dao'),
expect = chai.expect;
var RestDAO = require('../../src/js/dao/rest-dao'),
InvitationDAO = require('../../src/js/dao/invitation-dao');
describe('Invitation DAO unit tests', function() {
var restDaoStub, invitationDao,
@ -105,4 +103,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,13 +1,11 @@
define(function(require) {
'use strict';
var LawnchairDAO = require('js/dao/lawnchair-dao'),
PublicKeyDAO = require('js/dao/publickey-dao'),
KeychainDAO = require('js/dao/keychain-dao'),
PrivateKeyDAO = require('js/dao/privatekey-dao'),
Crypto = require('js/crypto/crypto'),
PGP = require('js/crypto/pgp'),
expect = chai.expect;
var LawnchairDAO = require('../../src/js/dao/lawnchair-dao'),
PublicKeyDAO = require('../../src/js/dao/publickey-dao'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
PrivateKeyDAO = require('../../src/js/dao/privatekey-dao'),
Crypto = require('../../src/js/crypto/crypto'),
PGP = require('../../src/js/crypto/pgp');
var testUser = 'test@example.com';
@ -1382,5 +1380,3 @@ define(function(require) {
});
});
});

View File

@ -1,8 +1,6 @@
define(function(require) {
'use strict';
var LawnchairDAO = require('js/dao/lawnchair-dao'),
expect = chai.expect;
var LawnchairDAO = require('../../src/js/dao/lawnchair-dao');
var dbName = 'lawnchair@test.com';
@ -148,5 +146,3 @@ define(function(require) {
});
});
});

View File

@ -1,14 +1,11 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
LoginCtrl = require('js/controller/login'),
EmailDAO = require('js/dao/email-dao'),
Auth = require('js/bo/auth'),
appController = require('js/app-controller'),
KeychainDAO = require('js/dao/keychain-dao');
var mocks = angular.mocks,
LoginCtrl = require('../../src/js/controller/login'),
EmailDAO = require('../../src/js/dao/email-dao'),
Auth = require('../../src/js/bo/auth'),
appController = require('../../src/js/app-controller'),
KeychainDAO = require('../../src/js/dao/keychain-dao');
describe('Login Controller unit test', function() {
var scope, location, ctrl,
@ -235,4 +232,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,14 +1,11 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
Auth = require('js/bo/auth'),
mocks = require('angularMocks'),
LoginExistingCtrl = require('js/controller/login-existing'),
EmailDAO = require('js/dao/email-dao'),
KeychainDAO = require('js/dao/keychain-dao'),
appController = require('js/app-controller');
var Auth = require('../../src/js/bo/auth'),
mocks = angular.mocks,
LoginExistingCtrl = require('../../src/js/controller/login-existing'),
EmailDAO = require('../../src/js/dao/email-dao'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
appController = require('../../src/js/app-controller');
describe('Login (existing user) Controller unit test', function() {
var scope, location, ctrl, origEmailDao, emailDaoMock,
@ -114,4 +111,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,14 +1,11 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
Auth = require('js/bo/auth'),
mocks = require('angularMocks'),
LoginInitialCtrl = require('js/controller/login-initial'),
PGP = require('js/crypto/pgp'),
EmailDAO = require('js/dao/email-dao'),
appController = require('js/app-controller');
var Auth = require('../../src/js/bo/auth'),
mocks = angular.mocks,
LoginInitialCtrl = require('../../src/js/controller/login-initial'),
PGP = require('../../src/js/crypto/pgp'),
EmailDAO = require('../../src/js/dao/email-dao'),
appController = require('../../src/js/app-controller');
describe('Login (initial user) Controller unit test', function() {
var scope, ctrl, location, origEmailDao, emailDaoMock,
@ -197,6 +194,4 @@ define(function(require) {
scope.generateKey();
});
});
});
});

View File

@ -1,14 +1,11 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
PGP = require('js/crypto/pgp'),
LoginNewDeviceCtrl = require('js/controller/login-new-device'),
KeychainDAO = require('js/dao/keychain-dao'),
EmailDAO = require('js/dao/email-dao'),
appController = require('js/app-controller');
var mocks = angular.mocks,
PGP = require('../../src/js/crypto/pgp'),
LoginNewDeviceCtrl = require('../../src/js/controller/login-new-device'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
EmailDAO = require('../../src/js/dao/email-dao'),
appController = require('../../src/js/app-controller');
describe('Login (new device) Controller unit test', function() {
var scope, ctrl, origEmailDao, emailDaoMock, pgpMock,
@ -187,4 +184,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,14 +1,11 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
Auth = require('js/bo/auth'),
LoginPrivateKeyDownloadCtrl = require('js/controller/login-privatekey-download'),
EmailDAO = require('js/dao/email-dao'),
appController = require('js/app-controller'),
KeychainDAO = require('js/dao/keychain-dao');
var mocks = angular.mocks,
Auth = require('../../src/js/bo/auth'),
LoginPrivateKeyDownloadCtrl = require('../../src/js/controller/login-privatekey-download'),
EmailDAO = require('../../src/js/dao/email-dao'),
appController = require('../../src/js/app-controller'),
KeychainDAO = require('../../src/js/dao/keychain-dao');
describe('Login Private Key Download Controller unit test', function() {
var scope, location, ctrl,
@ -261,4 +258,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,13 +1,10 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
Auth = require('js/bo/auth'),
ConnectionDoctor = require('js/util/connection-doctor'),
SetCredentialsCtrl = require('js/controller/login-set-credentials'),
appController = require('js/app-controller');
var mocks = angular.mocks,
Auth = require('../../src/js/bo/auth'),
ConnectionDoctor = require('../../src/js/util/connection-doctor'),
SetCredentialsCtrl = require('../../src/js/controller/login-set-credentials'),
appController = require('../../src/js/app-controller');
describe('Login (Set Credentials) Controller unit test', function() {
// Angular parameters
@ -98,4 +95,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,15 +1,12 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
MailListCtrl = require('js/controller/mail-list'),
EmailDAO = require('js/dao/email-dao'),
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
KeychainDAO = require('js/dao/keychain-dao'),
appController = require('js/app-controller'),
notification = require('js/util/notification');
var mocks = angular.mocks,
MailListCtrl = require('../../src/js/controller/mail-list'),
EmailDAO = require('../../src/js/dao/email-dao'),
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
appController = require('../../src/js/app-controller'),
notification = require('../../src/js/util/notification');
chai.Assertion.includeStack = true;
@ -448,4 +445,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,113 +0,0 @@
'use strict';
// 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;
};
}
// a warm round of applause for phantomjs for missing events
(function() {
function CustomEvent(event, params) {
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
})();
require(['../../src/require-config'], function() {
require.config({
baseUrl: '../../src/lib',
paths: {
angularMocks: '../../test/lib/angular-mocks'
},
shim: {
angularMocks: {
exports: 'angular.mock',
deps: ['angular']
}
}
});
// Start the main app logic.
require(['js/app-config', 'axe'], function(app, axe) {
app.config.workerPath = '../../src/js';
// turn off logging in the test
axe.removeAppender(axe.defaultAppender);
startTests();
});
});
function startTests() {
mocha.setup('bdd');
require(
[
'test/unit/oauth-test',
'test/unit/auth-test',
'test/unit/email-dao-test',
'test/unit/app-controller-test',
'test/unit/pgp-test',
'test/unit/crypto-test',
'test/unit/backbutton-handler-test',
'test/unit/rest-dao-test',
'test/unit/admin-dao-test',
'test/unit/publickey-dao-test',
'test/unit/privatekey-dao-test',
'test/unit/lawnchair-dao-test',
'test/unit/keychain-dao-test',
'test/unit/devicestorage-dao-test',
'test/unit/dialog-ctrl-test',
'test/unit/add-account-ctrl-test',
'test/unit/account-ctrl-test',
'test/unit/set-passphrase-ctrl-test',
'test/unit/contacts-ctrl-test',
'test/unit/login-existing-ctrl-test',
'test/unit/login-initial-ctrl-test',
'test/unit/login-new-device-ctrl-test',
'test/unit/login-privatekey-download-ctrl-test',
'test/unit/login-set-credentials-ctrl-test',
'test/unit/privatekey-upload-ctrl-test',
'test/unit/login-ctrl-test',
'test/unit/read-ctrl-test',
'test/unit/navigation-ctrl-test',
'test/unit/mail-list-ctrl-test',
'test/unit/write-ctrl-test',
'test/unit/outbox-bo-test',
'test/unit/invitation-dao-test',
'test/unit/update-handler-test',
'test/unit/connection-doctor-test'
], function() {
//Tests loaded, run tests
mocha.run();
}
);
}

View File

@ -1,13 +1,10 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
NavigationCtrl = require('js/controller/navigation'),
EmailDAO = require('js/dao/email-dao'),
OutboxBO = require('js/bo/outbox'),
appController = require('js/app-controller');
var mocks = angular.mocks,
NavigationCtrl = require('../../src/js/controller/navigation'),
EmailDAO = require('../../src/js/dao/email-dao'),
OutboxBO = require('../../src/js/bo/outbox'),
appController = require('../../src/js/app-controller');
describe('Navigation Controller unit test', function() {
var scope, ctrl, origEmailDao, emailDaoMock, outboxBoMock, outboxFolder, onConnectStub;
@ -98,4 +95,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,9 +1,7 @@
define(function(require) {
'use strict';
var OAuth = require('js/util/oauth'),
RestDAO = require('js/dao/rest-dao'),
expect = chai.expect;
var OAuth = require('../../src/js/util/oauth'),
RestDAO = require('../../src/js/dao/rest-dao');
describe('OAuth unit tests', function() {
var oauth, googleApiStub, identityStub, getPlatformInfoStub, removeCachedStub,
@ -198,4 +196,3 @@ define(function(require) {
});
});
});

View File

@ -1,11 +1,9 @@
define(function(require) {
'use strict';
var expect = chai.expect,
OutboxBO = require('js/bo/outbox'),
KeychainDAO = require('js/dao/keychain-dao'),
EmailDAO = require('js/dao/email-dao'),
DeviceStorageDAO = require('js/dao/devicestorage-dao');
var OutboxBO = require('../../src/js/bo/outbox'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
EmailDAO = require('../../src/js/dao/email-dao'),
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
chai.Assertion.includeStack = true;
@ -277,4 +275,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,9 +1,6 @@
define(function(require) {
'use strict';
var PGP = require('js/crypto/pgp'),
openpgp = require('openpgp'),
expect = chai.expect;
var PGP = require('../../src/js/crypto/pgp');
describe('PGP Crypto Api unit tests', function() {
this.timeout(20000);
@ -461,4 +458,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,9 +1,7 @@
define(function(require) {
'use strict';
var RestDAO = require('js/dao/rest-dao'),
PrivateKeyDAO = require('js/dao/privatekey-dao'),
expect = chai.expect;
var RestDAO = require('../../src/js/dao/rest-dao'),
PrivateKeyDAO = require('../../src/js/dao/privatekey-dao');
describe('Private Key DAO unit tests', function() {
@ -222,5 +220,3 @@ define(function(require) {
});
});
});

View File

@ -1,13 +1,10 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
PrivateKeyUploadCtrl = require('js/controller/privatekey-upload'),
appController = require('js/app-controller'),
KeychainDAO = require('js/dao/keychain-dao'),
PGP = require('js/crypto/pgp');
var mocks = angular.mocks,
PrivateKeyUploadCtrl = require('../../src/js/controller/privatekey-upload'),
appController = require('../../src/js/app-controller'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
PGP = require('../../src/js/crypto/pgp');
describe('Private Key Upload Controller unit test', function() {
var scope, location, ctrl,
@ -281,6 +278,4 @@ define(function(require) {
scope.goForward();
});
});
});
});

View File

@ -1,9 +1,7 @@
define(function(require) {
'use strict';
var RestDAO = require('js/dao/rest-dao'),
PublicKeyDAO = require('js/dao/publickey-dao'),
expect = chai.expect;
var RestDAO = require('../../src/js/dao/rest-dao'),
PublicKeyDAO = require('../../src/js/dao/publickey-dao');
describe('Public Key DAO unit tests', function() {
@ -161,5 +159,3 @@ define(function(require) {
});
});
});

View File

@ -1,15 +1,12 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
KeychainDAO = require('js/dao/keychain-dao'),
InvitationDAO = require('js/dao/invitation-dao'),
PGP = require('js/crypto/pgp'),
ReadCtrl = require('js/controller/read'),
OutboxBO = require('js/bo/outbox'),
appController = require('js/app-controller');
var mocks = angular.mocks,
KeychainDAO = require('../../src/js/dao/keychain-dao'),
InvitationDAO = require('../../src/js/dao/invitation-dao'),
PGP = require('../../src/js/crypto/pgp'),
ReadCtrl = require('../../src/js/controller/read'),
OutboxBO = require('../../src/js/bo/outbox'),
appController = require('../../src/js/app-controller');
describe('Read Controller unit test', function() {
var scope, ctrl,
@ -194,4 +191,3 @@ define(function(require) {
});
});
});

View File

@ -1,8 +1,6 @@
define(function(require) {
'use strict';
var RestDAO = require('js/dao/rest-dao'),
expect = chai.expect;
var RestDAO = require('../../src/js/dao/rest-dao');
describe('Rest DAO unit tests', function() {
@ -221,5 +219,3 @@ define(function(require) {
});
});
});

View File

@ -1,13 +1,10 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
SetPassphraseCtrl = require('js/controller/set-passphrase'),
PGP = require('js/crypto/pgp'),
appController = require('js/app-controller'),
KeychainDAO = require('js/dao/keychain-dao');
var mocks = angular.mocks,
SetPassphraseCtrl = require('../../src/js/controller/set-passphrase'),
PGP = require('../../src/js/crypto/pgp'),
appController = require('../../src/js/app-controller'),
KeychainDAO = require('../../src/js/dao/keychain-dao');
describe('Set Passphrase Controller unit test', function() {
var scope, setPassphraseCtrl,
@ -123,4 +120,3 @@ define(function(require) {
});
});
});

View File

@ -1,12 +1,10 @@
define(function(require) {
'use strict';
var DeviceStorageDAO = require('js/dao/devicestorage-dao'),
Auth = require('js/bo/auth'),
cfg = require('js/app-config').config,
UpdateHandler = require('js/util/update/update-handler'),
config = require('js/app-config').config,
expect = chai.expect;
var DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'),
Auth = require('../../src/js/bo/auth'),
cfg = require('../../src/js/app-config').config,
UpdateHandler = require('../../src/js/util/update/update-handler'),
config = require('../../src/js/app-config').config;
describe('UpdateHandler', function() {
var updateHandler, appConfigStorageStub, authStub, userStorageStub, origDbVersion;
@ -471,4 +469,3 @@ define(function(require) {
});
});
});
});

View File

@ -1,14 +1,11 @@
define(function(require) {
'use strict';
var expect = chai.expect,
angular = require('angular'),
mocks = require('angularMocks'),
WriteCtrl = require('js/controller/write'),
EmailDAO = require('js/dao/email-dao'),
OutboxBO = require('js/bo/outbox'),
KeychainDAO = require('js/dao/keychain-dao'),
appController = require('js/app-controller');
var mocks = angular.mocks,
WriteCtrl = require('../../src/js/controller/write'),
EmailDAO = require('../../src/js/dao/email-dao'),
OutboxBO = require('../../src/js/bo/outbox'),
KeychainDAO = require('../../src/js/dao/keychain-dao'),
appController = require('../../src/js/app-controller');
describe('Write controller unit test', function() {
var ctrl, scope,
@ -398,4 +395,3 @@ define(function(require) {
});
});
});