mirror of
https://github.com/moparisthebest/mail
synced 2024-11-29 04:12:18 -05:00
WIP add unit tests
This commit is contained in:
parent
c36cd069e0
commit
9bfda73969
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,3 +8,5 @@ dist/
|
|||||||
release/
|
release/
|
||||||
test/integration/src/
|
test/integration/src/
|
||||||
.elasticbeanstalk/
|
.elasticbeanstalk/
|
||||||
|
test/unit/index.js
|
||||||
|
test/unit/index.js.map
|
||||||
|
19
.jshintrc
19
.jshintrc
@ -18,19 +18,18 @@
|
|||||||
"unused": true,
|
"unused": true,
|
||||||
|
|
||||||
"predef": [
|
"predef": [
|
||||||
"console",
|
|
||||||
"Notification",
|
|
||||||
"importScripts",
|
|
||||||
"process",
|
|
||||||
"Event",
|
|
||||||
"chrome",
|
|
||||||
"define",
|
|
||||||
"self",
|
"self",
|
||||||
"describe",
|
"console",
|
||||||
"it",
|
"process",
|
||||||
"chai",
|
"chrome",
|
||||||
|
"Notification",
|
||||||
|
"Event",
|
||||||
"sinon",
|
"sinon",
|
||||||
"mocha",
|
"mocha",
|
||||||
|
"chai",
|
||||||
|
"expect",
|
||||||
|
"describe",
|
||||||
|
"it",
|
||||||
"before",
|
"before",
|
||||||
"beforeEach",
|
"beforeEach",
|
||||||
"after",
|
"after",
|
||||||
|
45
Gruntfile.js
45
Gruntfile.js
@ -1,6 +1,8 @@
|
|||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
require('time-grunt')(grunt);
|
||||||
|
|
||||||
var version = grunt.option('release'),
|
var version = grunt.option('release'),
|
||||||
zipName = (version) ? version : 'DEV';
|
zipName = (version) ? version : 'DEV';
|
||||||
|
|
||||||
@ -24,7 +26,7 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
jshint: {
|
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: {
|
options: {
|
||||||
jshintrc: '.jshintrc'
|
jshintrc: '.jshintrc'
|
||||||
}
|
}
|
||||||
@ -109,15 +111,21 @@ module.exports = function(grunt) {
|
|||||||
'dist/js/app.min.js': ['src/js/app.js']
|
'dist/js/app.min.js': ['src/js/app.js']
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
external: ['node-forge', 'net', 'tls'] // common.js apis not required at build time
|
external: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* TODO:
|
unitTest: {
|
||||||
tls-worker: {},
|
files: {
|
||||||
|
'test/unit/index.js': ['test/unit/*-test.js']
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
external: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
TODO:
|
||||||
mailreader-worker: {},
|
mailreader-worker: {},
|
||||||
pbkdf2-worker: {},
|
pbkdf2-worker: {},
|
||||||
unitTest: {},
|
|
||||||
unitTest: {},
|
|
||||||
integrationTest: {}
|
integrationTest: {}
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
@ -126,6 +134,7 @@ module.exports = function(grunt) {
|
|||||||
all: {
|
all: {
|
||||||
files: {
|
files: {
|
||||||
'dist/js/app.min.js': [
|
'dist/js/app.min.js': [
|
||||||
|
'src/lib/openpgp/openpgp.js',
|
||||||
'src/lib/underscore/underscore-min.js',
|
'src/lib/underscore/underscore-min.js',
|
||||||
'node_modules/jquery/dist/jquery.min.js',
|
'node_modules/jquery/dist/jquery.min.js',
|
||||||
'src/lib/angular/angular.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: {
|
options: {
|
||||||
banner: '/*! Copyright © <%= grunt.template.today("yyyy") %>, Whiteout Networks GmbH.*/\n'
|
banner: '/*! Copyright © <%= grunt.template.today("yyyy") %>, Whiteout Networks GmbH.*/\n'
|
||||||
}
|
}
|
||||||
@ -152,7 +183,7 @@ module.exports = function(grunt) {
|
|||||||
expand: true,
|
expand: true,
|
||||||
flatten: true,
|
flatten: true,
|
||||||
cwd: 'node_modules/',
|
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/'
|
dest: 'test/lib/'
|
||||||
},
|
},
|
||||||
font: {
|
font: {
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
"wo-smtpclient": "^0.3.8"
|
"wo-smtpclient": "^0.3.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"angular-mocks": "^1.2.25",
|
||||||
"angularjs": "https://github.com/whiteout-io/angular.js/tarball/npm-version",
|
"angularjs": "https://github.com/whiteout-io/angular.js/tarball/npm-version",
|
||||||
"browsercrow": "https://github.com/whiteout-io/browsercrow/tarball/master",
|
"browsercrow": "https://github.com/whiteout-io/browsercrow/tarball/master",
|
||||||
"browsersmtp": "https://github.com/whiteout-io/browsersmtp/tarball/master",
|
"browsersmtp": "https://github.com/whiteout-io/browsersmtp/tarball/master",
|
||||||
@ -65,6 +66,7 @@
|
|||||||
"grunt-manifest": "^0.4.0",
|
"grunt-manifest": "^0.4.0",
|
||||||
"grunt-mocha": "~0.4.1",
|
"grunt-mocha": "~0.4.1",
|
||||||
"mocha": "~1.13.0",
|
"mocha": "~1.13.0",
|
||||||
"sinon": "~1.7.3"
|
"sinon": "~1.7.3",
|
||||||
|
"time-grunt": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
AccountCtrl = require('../../src/js/controller/account'),
|
||||||
mocks = require('angularMocks'),
|
PGP = require('../../src/js/crypto/pgp'),
|
||||||
AccountCtrl = require('js/controller/account'),
|
dl = require('../../src/js/util/download'),
|
||||||
PGP = require('js/crypto/pgp'),
|
appController = require('../../src/js/app-controller'),
|
||||||
dl = require('js/util/download'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao');
|
||||||
appController = require('js/app-controller'),
|
|
||||||
KeychainDAO = require('js/dao/keychain-dao');
|
|
||||||
|
|
||||||
describe('Account Controller unit test', function() {
|
describe('Account Controller unit test', function() {
|
||||||
var scope, accountCtrl,
|
var scope, accountCtrl,
|
||||||
dummyFingerprint, expectedFingerprint,
|
dummyFingerprint, expectedFingerprint,
|
||||||
dummyKeyId, expectedKeyId,
|
dummyKeyId, expectedKeyId,
|
||||||
@ -97,5 +94,4 @@ define(function(require) {
|
|||||||
scope.exportKeyFile();
|
scope.exportKeyFile();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,15 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
AddAccountCtrl = require('../../src/js/controller/add-account'),
|
||||||
mocks = require('angularMocks'),
|
Auth = require('../../src/js/bo/auth'),
|
||||||
AddAccountCtrl = require('js/controller/add-account'),
|
AdminDao = require('../../src/js/dao/admin-dao'),
|
||||||
Auth = require('js/bo/auth'),
|
appController = require('../../src/js/app-controller');
|
||||||
AdminDao = require('js/dao/admin-dao'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Add Account Controller unit test', function() {
|
describe('Add Account Controller unit test', function() {
|
||||||
var scope, location, ctrl, authStub, origAuth, adminStub;
|
var scope, location, ctrl, authStub, origAuth, adminStub;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@ -212,5 +209,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,11 +1,9 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var RestDAO = require('js/dao/rest-dao'),
|
var RestDAO = require('../../src/js/dao/rest-dao'),
|
||||||
AdminDAO = require('js/dao/admin-dao'),
|
AdminDAO = require('../../src/js/dao/admin-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Admin DAO unit tests', function() {
|
describe('Admin DAO unit tests', function() {
|
||||||
|
|
||||||
var adminDao, restDaoStub,
|
var adminDao, restDaoStub,
|
||||||
emailAddress = 'test@example.com',
|
emailAddress = 'test@example.com',
|
||||||
@ -141,6 +139,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
@ -1,15 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var controller = require('js/app-controller'),
|
var controller = require('../../src/js/app-controller'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
OutboxBO = require('js/bo/outbox'),
|
OutboxBO = require('../../src/js/bo/outbox'),
|
||||||
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
|
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'),
|
||||||
UpdateHandler = require('js/util/update/update-handler'),
|
UpdateHandler = require('../../src/js/util/update/update-handler'),
|
||||||
Auth = require('js/bo/auth'),
|
Auth = require('../../src/js/bo/auth');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('App Controller unit tests', function() {
|
describe('App Controller unit tests', function() {
|
||||||
var emailDaoStub, outboxStub, updateHandlerStub, appConfigStoreStub, devicestorageStub, isOnlineStub, authStub;
|
var emailDaoStub, outboxStub, updateHandlerStub, appConfigStoreStub, devicestorageStub, isOnlineStub, authStub;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@ -209,5 +207,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,13 +1,11 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var Auth = require('js/bo/auth'),
|
var Auth = require('../../src/js/bo/auth'),
|
||||||
OAuth = require('js/util/oauth'),
|
OAuth = require('../../src/js/util/oauth'),
|
||||||
PGP = require('js/crypto/pgp'),
|
PGP = require('../../src/js/crypto/pgp'),
|
||||||
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
|
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Auth unit tests', function() {
|
describe('Auth unit tests', function() {
|
||||||
// Constancts
|
// Constancts
|
||||||
var EMAIL_ADDR_DB_KEY = 'emailaddress';
|
var EMAIL_ADDR_DB_KEY = 'emailaddress';
|
||||||
var USERNAME_DB_KEY = 'username';
|
var USERNAME_DB_KEY = 'username';
|
||||||
@ -374,5 +372,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,10 +1,8 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var btnHandler = require('js/util/backbutton-handler'),
|
var btnHandler = require('../../src/js/util/backbutton-handler');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Backbutton Handler', function() {
|
describe('Backbutton Handler', function() {
|
||||||
chai.Assertion.includeStack = true;
|
chai.Assertion.includeStack = true;
|
||||||
|
|
||||||
var scope, event;
|
var scope, event;
|
||||||
@ -63,5 +61,4 @@ define(function(require) {
|
|||||||
navigator.app.exitApp = done;
|
navigator.app.exitApp = done;
|
||||||
document.dispatchEvent(event);
|
document.dispatchEvent(event);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,14 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var ConnectionDoctor = require('js/util/connection-doctor'),
|
var TCPSocket = require('tcp-socket'),
|
||||||
TCPSocket = require('tcp-socket'),
|
|
||||||
ImapClient = require('imap-client'),
|
ImapClient = require('imap-client'),
|
||||||
SmtpClient = require('smtpclient'),
|
SmtpClient = require('wo-smtpclient'),
|
||||||
cfg = require('js/app-config').config,
|
ConnectionDoctor = require('../../src/js/util/connection-doctor'),
|
||||||
expect = chai.expect;
|
cfg = require('../../src/js/app-config').config;
|
||||||
|
|
||||||
describe('Connection Doctor', function() {
|
describe('Connection Doctor', function() {
|
||||||
var doctor;
|
var doctor;
|
||||||
var socketStub, imapStub, smtpStub, credentials;
|
var socketStub, imapStub, smtpStub, credentials;
|
||||||
|
|
||||||
@ -410,5 +408,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,15 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
ContactsCtrl = require('../../src/js/controller/contacts'),
|
||||||
mocks = require('angularMocks'),
|
appController = require('../../src/js/app-controller'),
|
||||||
ContactsCtrl = require('js/controller/contacts'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
appController = require('js/app-controller'),
|
PGP = require('../../src/js/crypto/pgp');
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
|
||||||
PGP = require('js/crypto/pgp');
|
|
||||||
|
|
||||||
describe('Contacts Controller unit test', function() {
|
describe('Contacts Controller unit test', function() {
|
||||||
var scope, contactsCtrl,
|
var scope, contactsCtrl,
|
||||||
origKeychain, keychainMock,
|
origKeychain, keychainMock,
|
||||||
origPgp, pgpMock;
|
origPgp, pgpMock;
|
||||||
@ -186,5 +183,4 @@ define(function(require) {
|
|||||||
scope.removeKey(key);
|
scope.removeKey(key);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,12 +1,10 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var Crypto = require('js/crypto/crypto'),
|
var Crypto = require('../../src/js/crypto/crypto'),
|
||||||
util = require('js/crypto/util'),
|
config = require('../../src/js/app-config').config,
|
||||||
config = require('js/app-config').config,
|
util = require('crypto-lib').util;
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Crypto unit tests', function() {
|
describe('Crypto unit tests', function() {
|
||||||
this.timeout(20000);
|
this.timeout(20000);
|
||||||
|
|
||||||
var crypto,
|
var crypto,
|
||||||
@ -54,5 +52,4 @@ define(function(require) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,13 +1,11 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var LawnchairDAO = require('js/dao/lawnchair-dao'),
|
var LawnchairDAO = require('../../src/js/dao/lawnchair-dao'),
|
||||||
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
|
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
var testUser = 'test@example.com';
|
var testUser = 'test@example.com';
|
||||||
|
|
||||||
describe('Device Storage DAO unit tests', function() {
|
describe('Device Storage DAO unit tests', function() {
|
||||||
|
|
||||||
var storageDao, lawnchairDaoStub;
|
var storageDao, lawnchairDaoStub;
|
||||||
|
|
||||||
@ -100,6 +98,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
@ -1,12 +1,9 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
DialogCtrl = require('../../src/js/controller/dialog');
|
||||||
mocks = require('angularMocks'),
|
|
||||||
DialogCtrl = require('js/controller/dialog');
|
|
||||||
|
|
||||||
describe('Dialog Controller unit test', function() {
|
describe('Dialog Controller unit test', function() {
|
||||||
var scope, dialogCtrl;
|
var scope, dialogCtrl;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@ -46,5 +43,4 @@ define(function(require) {
|
|||||||
scope.confirm(false);
|
scope.confirm(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,19 +1,17 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var EmailDAO = require('js/dao/email-dao'),
|
var mailreader = require('mailreader'),
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
|
||||||
ImapClient = require('imap-client'),
|
ImapClient = require('imap-client'),
|
||||||
PgpMailer = require('pgpmailer'),
|
PgpMailer = require('pgpmailer'),
|
||||||
PgpBuilder = require('pgpbuilder'),
|
PgpBuilder = require('pgpbuilder'),
|
||||||
PGP = require('js/crypto/pgp'),
|
cfg = require('../../src/js/app-config').config,
|
||||||
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
mailreader = require('mailreader'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
cfg = require('js/app-config').config,
|
PGP = require('../../src/js/crypto/pgp'),
|
||||||
expect = chai.expect;
|
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
|
||||||
|
|
||||||
|
|
||||||
describe('Email DAO unit tests', function() {
|
describe('Email DAO unit tests', function() {
|
||||||
// show the stack trace when an error occurred
|
// show the stack trace when an error occurred
|
||||||
chai.Assertion.includeStack = true;
|
chai.Assertion.includeStack = true;
|
||||||
|
|
||||||
@ -2300,5 +2298,4 @@ define(function(require) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -9,11 +9,70 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="mocha"></div>
|
<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/chai.js"></script>
|
||||||
<script src="../lib/sinon.js"></script>
|
|
||||||
<script src="../lib/mocha.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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var RestDAO = require('js/dao/rest-dao'),
|
var RestDAO = require('../../src/js/dao/rest-dao'),
|
||||||
InvitationDAO = require('js/dao/invitation-dao'),
|
InvitationDAO = require('../../src/js/dao/invitation-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Invitation DAO unit tests', function() {
|
describe('Invitation DAO unit tests', function() {
|
||||||
var restDaoStub, invitationDao,
|
var restDaoStub, invitationDao,
|
||||||
alice = 'zuhause@aol.com',
|
alice = 'zuhause@aol.com',
|
||||||
bob = 'manfred.mustermann@musterdomain.com',
|
bob = 'manfred.mustermann@musterdomain.com',
|
||||||
@ -104,5 +102,4 @@ define(function(require) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,17 +1,15 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var LawnchairDAO = require('js/dao/lawnchair-dao'),
|
var LawnchairDAO = require('../../src/js/dao/lawnchair-dao'),
|
||||||
PublicKeyDAO = require('js/dao/publickey-dao'),
|
PublicKeyDAO = require('../../src/js/dao/publickey-dao'),
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
PrivateKeyDAO = require('js/dao/privatekey-dao'),
|
PrivateKeyDAO = require('../../src/js/dao/privatekey-dao'),
|
||||||
Crypto = require('js/crypto/crypto'),
|
Crypto = require('../../src/js/crypto/crypto'),
|
||||||
PGP = require('js/crypto/pgp'),
|
PGP = require('../../src/js/crypto/pgp');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
var testUser = 'test@example.com';
|
var testUser = 'test@example.com';
|
||||||
|
|
||||||
describe('Keychain DAO unit tests', function() {
|
describe('Keychain DAO unit tests', function() {
|
||||||
|
|
||||||
var keychainDao, lawnchairDaoStub, pubkeyDaoStub, privkeyDaoStub, cryptoStub, pgpStub;
|
var keychainDao, lawnchairDaoStub, pubkeyDaoStub, privkeyDaoStub, cryptoStub, pgpStub;
|
||||||
|
|
||||||
@ -1381,6 +1379,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
@ -1,25 +1,23 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var LawnchairDAO = require('js/dao/lawnchair-dao'),
|
var LawnchairDAO = require('../../src/js/dao/lawnchair-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
|
|
||||||
var dbName = 'lawnchair@test.com';
|
var dbName = 'lawnchair@test.com';
|
||||||
|
|
||||||
var key = 'type_1';
|
var key = 'type_1';
|
||||||
var data = {
|
var data = {
|
||||||
name: 'testName1',
|
name: 'testName1',
|
||||||
type: 'testType1'
|
type: 'testType1'
|
||||||
};
|
};
|
||||||
|
|
||||||
var key2 = 'type_2';
|
var key2 = 'type_2';
|
||||||
var data2 = {
|
var data2 = {
|
||||||
name: 'testName2',
|
name: 'testName2',
|
||||||
type: 'testType2'
|
type: 'testType2'
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Lawnchair DAO unit tests', function() {
|
describe('Lawnchair DAO unit tests', function() {
|
||||||
var lawnchairDao;
|
var lawnchairDao;
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
@ -147,6 +145,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
@ -1,16 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
LoginCtrl = require('../../src/js/controller/login'),
|
||||||
mocks = require('angularMocks'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
LoginCtrl = require('js/controller/login'),
|
Auth = require('../../src/js/bo/auth'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
appController = require('../../src/js/app-controller'),
|
||||||
Auth = require('js/bo/auth'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao');
|
||||||
appController = require('js/app-controller'),
|
|
||||||
KeychainDAO = require('js/dao/keychain-dao');
|
|
||||||
|
|
||||||
describe('Login Controller unit test', function() {
|
describe('Login Controller unit test', function() {
|
||||||
var scope, location, ctrl,
|
var scope, location, ctrl,
|
||||||
origEmailDao, emailDaoMock,
|
origEmailDao, emailDaoMock,
|
||||||
origKeychain, keychainMock,
|
origKeychain, keychainMock,
|
||||||
@ -234,5 +231,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,16 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var Auth = require('../../src/js/bo/auth'),
|
||||||
angular = require('angular'),
|
mocks = angular.mocks,
|
||||||
Auth = require('js/bo/auth'),
|
LoginExistingCtrl = require('../../src/js/controller/login-existing'),
|
||||||
mocks = require('angularMocks'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
LoginExistingCtrl = require('js/controller/login-existing'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
appController = require('../../src/js/app-controller');
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Login (existing user) Controller unit test', function() {
|
describe('Login (existing user) Controller unit test', function() {
|
||||||
var scope, location, ctrl, origEmailDao, emailDaoMock,
|
var scope, location, ctrl, origEmailDao, emailDaoMock,
|
||||||
origAuth, authMock,
|
origAuth, authMock,
|
||||||
emailAddress = 'fred@foo.com',
|
emailAddress = 'fred@foo.com',
|
||||||
@ -113,5 +110,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,16 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var Auth = require('../../src/js/bo/auth'),
|
||||||
angular = require('angular'),
|
mocks = angular.mocks,
|
||||||
Auth = require('js/bo/auth'),
|
LoginInitialCtrl = require('../../src/js/controller/login-initial'),
|
||||||
mocks = require('angularMocks'),
|
PGP = require('../../src/js/crypto/pgp'),
|
||||||
LoginInitialCtrl = require('js/controller/login-initial'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
PGP = require('js/crypto/pgp'),
|
appController = require('../../src/js/app-controller');
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Login (initial user) Controller unit test', function() {
|
describe('Login (initial user) Controller unit test', function() {
|
||||||
var scope, ctrl, location, origEmailDao, emailDaoMock,
|
var scope, ctrl, location, origEmailDao, emailDaoMock,
|
||||||
origAuth, authMock,
|
origAuth, authMock,
|
||||||
emailAddress = 'fred@foo.com',
|
emailAddress = 'fred@foo.com',
|
||||||
@ -197,6 +194,4 @@ define(function(require) {
|
|||||||
scope.generateKey();
|
scope.generateKey();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,16 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
PGP = require('../../src/js/crypto/pgp'),
|
||||||
mocks = require('angularMocks'),
|
LoginNewDeviceCtrl = require('../../src/js/controller/login-new-device'),
|
||||||
PGP = require('js/crypto/pgp'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
LoginNewDeviceCtrl = require('js/controller/login-new-device'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
appController = require('../../src/js/app-controller');
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Login (new device) Controller unit test', function() {
|
describe('Login (new device) Controller unit test', function() {
|
||||||
var scope, ctrl, origEmailDao, emailDaoMock, pgpMock,
|
var scope, ctrl, origEmailDao, emailDaoMock, pgpMock,
|
||||||
emailAddress = 'fred@foo.com',
|
emailAddress = 'fred@foo.com',
|
||||||
passphrase = 'asd',
|
passphrase = 'asd',
|
||||||
@ -186,5 +183,4 @@ define(function(require) {
|
|||||||
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;
|
expect(keychainMock.getUserKeyPair.calledOnce).to.be.true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,16 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
Auth = require('../../src/js/bo/auth'),
|
||||||
mocks = require('angularMocks'),
|
LoginPrivateKeyDownloadCtrl = require('../../src/js/controller/login-privatekey-download'),
|
||||||
Auth = require('js/bo/auth'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
LoginPrivateKeyDownloadCtrl = require('js/controller/login-privatekey-download'),
|
appController = require('../../src/js/app-controller'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao');
|
||||||
appController = require('js/app-controller'),
|
|
||||||
KeychainDAO = require('js/dao/keychain-dao');
|
|
||||||
|
|
||||||
describe('Login Private Key Download Controller unit test', function() {
|
describe('Login Private Key Download Controller unit test', function() {
|
||||||
var scope, location, ctrl,
|
var scope, location, ctrl,
|
||||||
origEmailDao, emailDaoMock,
|
origEmailDao, emailDaoMock,
|
||||||
origAuth, authMock,
|
origAuth, authMock,
|
||||||
@ -260,5 +257,4 @@ define(function(require) {
|
|||||||
scope.goTo('/desktop');
|
scope.goTo('/desktop');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,15 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
Auth = require('../../src/js/bo/auth'),
|
||||||
mocks = require('angularMocks'),
|
ConnectionDoctor = require('../../src/js/util/connection-doctor'),
|
||||||
Auth = require('js/bo/auth'),
|
SetCredentialsCtrl = require('../../src/js/controller/login-set-credentials'),
|
||||||
ConnectionDoctor = require('js/util/connection-doctor'),
|
appController = require('../../src/js/app-controller');
|
||||||
SetCredentialsCtrl = require('js/controller/login-set-credentials'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Login (Set Credentials) Controller unit test', function() {
|
describe('Login (Set Credentials) Controller unit test', function() {
|
||||||
// Angular parameters
|
// Angular parameters
|
||||||
var scope, location, provider;
|
var scope, location, provider;
|
||||||
|
|
||||||
@ -97,5 +94,4 @@ define(function(require) {
|
|||||||
expect(auth.setCredentials.calledOnce).to.be.true;
|
expect(auth.setCredentials.calledOnce).to.be.true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,19 +1,16 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
MailListCtrl = require('../../src/js/controller/mail-list'),
|
||||||
mocks = require('angularMocks'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
MailListCtrl = require('js/controller/mail-list'),
|
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
DeviceStorageDAO = require('js/dao/devicestorage-dao'),
|
appController = require('../../src/js/app-controller'),
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
notification = require('../../src/js/util/notification');
|
||||||
appController = require('js/app-controller'),
|
|
||||||
notification = require('js/util/notification');
|
|
||||||
|
|
||||||
chai.Assertion.includeStack = true;
|
chai.Assertion.includeStack = true;
|
||||||
|
|
||||||
describe('Mail List controller unit test', function() {
|
describe('Mail List controller unit test', function() {
|
||||||
var scope, ctrl, origEmailDao, emailDaoMock, keychainMock, deviceStorageMock,
|
var scope, ctrl, origEmailDao, emailDaoMock, keychainMock, deviceStorageMock,
|
||||||
emailAddress, emails,
|
emailAddress, emails,
|
||||||
hasChrome, hasSocket, hasRuntime, hasIdentity;
|
hasChrome, hasSocket, hasRuntime, hasIdentity;
|
||||||
@ -447,5 +444,4 @@ define(function(require) {
|
|||||||
expect(scope.state.mailList.selected).to.exist;
|
expect(scope.state.mailList.selected).to.exist;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -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();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,15 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
NavigationCtrl = require('../../src/js/controller/navigation'),
|
||||||
mocks = require('angularMocks'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
NavigationCtrl = require('js/controller/navigation'),
|
OutboxBO = require('../../src/js/bo/outbox'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
appController = require('../../src/js/app-controller');
|
||||||
OutboxBO = require('js/bo/outbox'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Navigation Controller unit test', function() {
|
describe('Navigation Controller unit test', function() {
|
||||||
var scope, ctrl, origEmailDao, emailDaoMock, outboxBoMock, outboxFolder, onConnectStub;
|
var scope, ctrl, origEmailDao, emailDaoMock, outboxBoMock, outboxFolder, onConnectStub;
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
@ -97,5 +94,4 @@ define(function(require) {
|
|||||||
expect(outboxFolder.count).to.equal(5);
|
expect(outboxFolder.count).to.equal(5);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,11 +1,9 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var OAuth = require('js/util/oauth'),
|
var OAuth = require('../../src/js/util/oauth'),
|
||||||
RestDAO = require('js/dao/rest-dao'),
|
RestDAO = require('../../src/js/dao/rest-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('OAuth unit tests', function() {
|
describe('OAuth unit tests', function() {
|
||||||
var oauth, googleApiStub, identityStub, getPlatformInfoStub, removeCachedStub,
|
var oauth, googleApiStub, identityStub, getPlatformInfoStub, removeCachedStub,
|
||||||
testEmail = 'test@example.com';
|
testEmail = 'test@example.com';
|
||||||
|
|
||||||
@ -197,5 +195,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,15 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var OutboxBO = require('../../src/js/bo/outbox'),
|
||||||
OutboxBO = require('js/bo/outbox'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao');
|
||||||
DeviceStorageDAO = require('js/dao/devicestorage-dao');
|
|
||||||
|
|
||||||
chai.Assertion.includeStack = true;
|
chai.Assertion.includeStack = true;
|
||||||
|
|
||||||
describe('Outbox Business Object unit test', function() {
|
describe('Outbox Business Object unit test', function() {
|
||||||
var outbox, emailDaoStub, devicestorageStub, keychainStub,
|
var outbox, emailDaoStub, devicestorageStub, keychainStub,
|
||||||
dummyUser = 'spiderpig@springfield.com';
|
dummyUser = 'spiderpig@springfield.com';
|
||||||
|
|
||||||
@ -276,5 +274,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,11 +1,8 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var PGP = require('js/crypto/pgp'),
|
var PGP = require('../../src/js/crypto/pgp');
|
||||||
openpgp = require('openpgp'),
|
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('PGP Crypto Api unit tests', function() {
|
describe('PGP Crypto Api unit tests', function() {
|
||||||
this.timeout(20000);
|
this.timeout(20000);
|
||||||
|
|
||||||
var pgp,
|
var pgp,
|
||||||
@ -460,5 +457,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,11 +1,9 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var RestDAO = require('js/dao/rest-dao'),
|
var RestDAO = require('../../src/js/dao/rest-dao'),
|
||||||
PrivateKeyDAO = require('js/dao/privatekey-dao'),
|
PrivateKeyDAO = require('../../src/js/dao/privatekey-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Private Key DAO unit tests', function() {
|
describe('Private Key DAO unit tests', function() {
|
||||||
|
|
||||||
var privkeyDao, restDaoStub,
|
var privkeyDao, restDaoStub,
|
||||||
emailAddress = 'test@example.com',
|
emailAddress = 'test@example.com',
|
||||||
@ -221,6 +219,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
@ -1,15 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
PrivateKeyUploadCtrl = require('../../src/js/controller/privatekey-upload'),
|
||||||
mocks = require('angularMocks'),
|
appController = require('../../src/js/app-controller'),
|
||||||
PrivateKeyUploadCtrl = require('js/controller/privatekey-upload'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
appController = require('js/app-controller'),
|
PGP = require('../../src/js/crypto/pgp');
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
|
||||||
PGP = require('js/crypto/pgp');
|
|
||||||
|
|
||||||
describe('Private Key Upload Controller unit test', function() {
|
describe('Private Key Upload Controller unit test', function() {
|
||||||
var scope, location, ctrl,
|
var scope, location, ctrl,
|
||||||
origEmailDao, emailDaoMock,
|
origEmailDao, emailDaoMock,
|
||||||
origKeychain, keychainMock,
|
origKeychain, keychainMock,
|
||||||
@ -281,6 +278,4 @@ define(function(require) {
|
|||||||
scope.goForward();
|
scope.goForward();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,11 +1,9 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var RestDAO = require('js/dao/rest-dao'),
|
var RestDAO = require('../../src/js/dao/rest-dao'),
|
||||||
PublicKeyDAO = require('js/dao/publickey-dao'),
|
PublicKeyDAO = require('../../src/js/dao/publickey-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Public Key DAO unit tests', function() {
|
describe('Public Key DAO unit tests', function() {
|
||||||
|
|
||||||
var pubkeyDao, restDaoStub;
|
var pubkeyDao, restDaoStub;
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ define(function(require) {
|
|||||||
|
|
||||||
pubkeyDao.verify(uuid, function(err) {
|
pubkeyDao.verify(uuid, function(err) {
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
expect(restDaoStub.get.calledWith(sinon.match(function(arg){
|
expect(restDaoStub.get.calledWith(sinon.match(function(arg) {
|
||||||
return arg.uri === '/verify/' + uuid && arg.type === 'text';
|
return arg.uri === '/verify/' + uuid && arg.type === 'text';
|
||||||
}))).to.be.true;
|
}))).to.be.true;
|
||||||
done();
|
done();
|
||||||
@ -160,6 +158,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
@ -1,17 +1,14 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
mocks = require('angularMocks'),
|
InvitationDAO = require('../../src/js/dao/invitation-dao'),
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
PGP = require('../../src/js/crypto/pgp'),
|
||||||
InvitationDAO = require('js/dao/invitation-dao'),
|
ReadCtrl = require('../../src/js/controller/read'),
|
||||||
PGP = require('js/crypto/pgp'),
|
OutboxBO = require('../../src/js/bo/outbox'),
|
||||||
ReadCtrl = require('js/controller/read'),
|
appController = require('../../src/js/app-controller');
|
||||||
OutboxBO = require('js/bo/outbox'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Read Controller unit test', function() {
|
describe('Read Controller unit test', function() {
|
||||||
var scope, ctrl,
|
var scope, ctrl,
|
||||||
origKeychain, keychainMock,
|
origKeychain, keychainMock,
|
||||||
origInvitation, invitationMock,
|
origInvitation, invitationMock,
|
||||||
@ -193,5 +190,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,10 +1,8 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var RestDAO = require('js/dao/rest-dao'),
|
var RestDAO = require('../../src/js/dao/rest-dao');
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('Rest DAO unit tests', function() {
|
describe('Rest DAO unit tests', function() {
|
||||||
|
|
||||||
var restDao, xhrMock, requests;
|
var restDao, xhrMock, requests;
|
||||||
|
|
||||||
@ -220,6 +218,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
@ -1,15 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
SetPassphraseCtrl = require('../../src/js/controller/set-passphrase'),
|
||||||
mocks = require('angularMocks'),
|
PGP = require('../../src/js/crypto/pgp'),
|
||||||
SetPassphraseCtrl = require('js/controller/set-passphrase'),
|
appController = require('../../src/js/app-controller'),
|
||||||
PGP = require('js/crypto/pgp'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao');
|
||||||
appController = require('js/app-controller'),
|
|
||||||
KeychainDAO = require('js/dao/keychain-dao');
|
|
||||||
|
|
||||||
describe('Set Passphrase Controller unit test', function() {
|
describe('Set Passphrase Controller unit test', function() {
|
||||||
var scope, setPassphraseCtrl,
|
var scope, setPassphraseCtrl,
|
||||||
dummyFingerprint, expectedFingerprint,
|
dummyFingerprint, expectedFingerprint,
|
||||||
dummyKeyId, expectedKeyId,
|
dummyKeyId, expectedKeyId,
|
||||||
@ -122,5 +119,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,14 +1,12 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var DeviceStorageDAO = require('js/dao/devicestorage-dao'),
|
var DeviceStorageDAO = require('../../src/js/dao/devicestorage-dao'),
|
||||||
Auth = require('js/bo/auth'),
|
Auth = require('../../src/js/bo/auth'),
|
||||||
cfg = require('js/app-config').config,
|
cfg = require('../../src/js/app-config').config,
|
||||||
UpdateHandler = require('js/util/update/update-handler'),
|
UpdateHandler = require('../../src/js/util/update/update-handler'),
|
||||||
config = require('js/app-config').config,
|
config = require('../../src/js/app-config').config;
|
||||||
expect = chai.expect;
|
|
||||||
|
|
||||||
describe('UpdateHandler', function() {
|
describe('UpdateHandler', function() {
|
||||||
var updateHandler, appConfigStorageStub, authStub, userStorageStub, origDbVersion;
|
var updateHandler, appConfigStorageStub, authStub, userStorageStub, origDbVersion;
|
||||||
|
|
||||||
chai.Assertion.includeStack = true;
|
chai.Assertion.includeStack = true;
|
||||||
@ -470,5 +468,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
@ -1,16 +1,13 @@
|
|||||||
define(function(require) {
|
'use strict';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var expect = chai.expect,
|
var mocks = angular.mocks,
|
||||||
angular = require('angular'),
|
WriteCtrl = require('../../src/js/controller/write'),
|
||||||
mocks = require('angularMocks'),
|
EmailDAO = require('../../src/js/dao/email-dao'),
|
||||||
WriteCtrl = require('js/controller/write'),
|
OutboxBO = require('../../src/js/bo/outbox'),
|
||||||
EmailDAO = require('js/dao/email-dao'),
|
KeychainDAO = require('../../src/js/dao/keychain-dao'),
|
||||||
OutboxBO = require('js/bo/outbox'),
|
appController = require('../../src/js/app-controller');
|
||||||
KeychainDAO = require('js/dao/keychain-dao'),
|
|
||||||
appController = require('js/app-controller');
|
|
||||||
|
|
||||||
describe('Write controller unit test', function() {
|
describe('Write controller unit test', function() {
|
||||||
var ctrl, scope,
|
var ctrl, scope,
|
||||||
origEmailDao, origOutbox, origKeychain,
|
origEmailDao, origOutbox, origKeychain,
|
||||||
emailDaoMock, keychainMock, outboxMock, emailAddress, realname;
|
emailDaoMock, keychainMock, outboxMock, emailAddress, realname;
|
||||||
@ -397,5 +394,4 @@ define(function(require) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user