mirror of
https://github.com/moparisthebest/mail
synced 2024-12-22 15:28:49 -05:00
Dao and crypto unit tests work
This commit is contained in:
parent
b5b95d1c5c
commit
7e09add0f4
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,3 +9,5 @@ release/
|
||||
test/integration/src/
|
||||
.elasticbeanstalk/
|
||||
test/unit/index.js
|
||||
**/*.browserified.js
|
||||
**/*.js.map
|
||||
|
37
Gruntfile.js
37
Gruntfile.js
@ -121,7 +121,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
unitTest: {
|
||||
files: {
|
||||
'test/unit/index.js': [
|
||||
'test/unit/index.browserified.js': [
|
||||
'test/unit/oauth-test.js',
|
||||
'test/unit/auth-test.js',
|
||||
'test/unit/email-dao-test.js',
|
||||
@ -155,7 +155,8 @@ module.exports = function(grunt) {
|
||||
'test/unit/outbox-bo-test.js',
|
||||
'test/unit/invitation-dao-test.js',
|
||||
'test/unit/update-handler-test.js',
|
||||
'test/unit/connection-doctor-test.js'
|
||||
'test/unit/connection-doctor-test.js',
|
||||
'test/unit/main.js'
|
||||
]
|
||||
},
|
||||
options: {
|
||||
@ -216,25 +217,25 @@ module.exports = function(grunt) {
|
||||
'test/unit/index.js': [
|
||||
'src/lib/underscore/underscore-min.js',
|
||||
'node_modules/jquery/dist/jquery.min.js',
|
||||
'src/lib/forge/forge.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',
|
||||
'node_modules/angular-mocks/angular-mocks.js',
|
||||
'src/lib/fastclick/fastclick.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'
|
||||
'test/unit/index.browserified.js'
|
||||
]
|
||||
},
|
||||
options: {
|
||||
compress: false
|
||||
mangle: false,
|
||||
compress: false,
|
||||
sourceMap: true,
|
||||
sourceMapName: 'test/unit/index.js.map'
|
||||
}
|
||||
},
|
||||
options: {
|
||||
@ -246,8 +247,19 @@ module.exports = function(grunt) {
|
||||
npmDev: {
|
||||
expand: true,
|
||||
flatten: true,
|
||||
cwd: 'node_modules/',
|
||||
src: ['mocha/mocha.css', 'mocha/mocha.js', 'chai/chai.js', 'sinon/pkg/sinon.js', 'browsercrow/src/*.js', 'browsersmtp/src/*.js'],
|
||||
cwd: './',
|
||||
src: [
|
||||
'node_modules/mocha/mocha.css',
|
||||
'node_modules/mocha/mocha.js',
|
||||
'node_modules/chai/chai.js',
|
||||
'node_modules/sinon/pkg/sinon.js',
|
||||
'node_modules/browsercrow/src/*.js',
|
||||
'node_modules/browsersmtp/src/*.js',
|
||||
'src/lib/openpgp/openpgp.js',
|
||||
'src/lib/openpgp/openpgp.worker.js',
|
||||
'src/lib/forge/forge.min.js',
|
||||
'dist/js/pbkdf2-worker.min.js'
|
||||
],
|
||||
dest: 'test/lib/'
|
||||
},
|
||||
lib: {
|
||||
@ -343,11 +355,10 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-manifest');
|
||||
|
||||
// Build tasks
|
||||
grunt.registerTask('dist-npm', ['copy:npmDev']);
|
||||
grunt.registerTask('dist-css', ['sass', 'autoprefixer', 'csso']);
|
||||
grunt.registerTask('dist-js', ['browserify', 'uglify']);
|
||||
grunt.registerTask('dist-copy', ['copy']);
|
||||
grunt.registerTask('dist', ['clean', 'dist-npm', 'dist-css', 'dist-js', 'dist-copy', 'manifest']);
|
||||
grunt.registerTask('dist', ['clean', 'dist-css', 'dist-js', 'dist-copy', 'manifest']);
|
||||
|
||||
// Test/Dev tasks
|
||||
grunt.registerTask('dev', ['connect:dev']);
|
||||
|
@ -73,7 +73,7 @@ ctrl.buildModules = function() {
|
||||
var lawnchairDao, restDao, pubkeyDao, privkeyDao, crypto, emailDao, keychain, pgp, userStorage, pgpbuilder, oauth, appConfigStore, auth;
|
||||
|
||||
// start the mailreader's worker thread
|
||||
mailreader.startWorker(config.workerPath + '/../lib/mailreader-parser-worker.js');
|
||||
mailreader.startWorker(config.workerPath + '/mailreader-parser-worker.js');
|
||||
|
||||
// init objects and inject dependencies
|
||||
restDao = new RestDAO();
|
||||
|
@ -10,8 +10,6 @@ var aes = require('crypto-lib').aes,
|
||||
config = require('../app-config').config,
|
||||
axe = require('axe-logger');
|
||||
|
||||
var PBKDF2_WORKER = config.workerPath + '/pbkdf2-worker.js';
|
||||
|
||||
var Crypto = function() {};
|
||||
|
||||
/**
|
||||
@ -61,7 +59,7 @@ Crypto.prototype.decrypt = function(ciphertext, key, iv, callback) {
|
||||
*/
|
||||
Crypto.prototype.deriveKey = function(password, salt, keySize, callback) {
|
||||
startWorker({
|
||||
script: PBKDF2_WORKER,
|
||||
script: config.workerPath + '/pbkdf2-worker.min.js',
|
||||
args: {
|
||||
password: password,
|
||||
salt: salt,
|
||||
@ -82,7 +80,7 @@ function startWorker(options) {
|
||||
// check for WebWorker support
|
||||
if (window.Worker) {
|
||||
// init webworker thread
|
||||
var worker = new Worker(config.workerPath + options.script);
|
||||
var worker = new Worker(options.script);
|
||||
worker.onmessage = function(e) {
|
||||
if (e.data.err) {
|
||||
options.callback(e.data.err);
|
||||
|
@ -13,7 +13,7 @@
|
||||
//
|
||||
// Polyfills
|
||||
//
|
||||
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
// Mozilla bind polyfill because phantomjs is stupid
|
||||
@ -57,7 +57,7 @@
|
||||
})();
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
||||
<script src="../lib/chai.js"></script>
|
||||
<script src="../lib/mocha.js"></script>
|
||||
<script src="../lib/sinon.js"></script>
|
||||
@ -67,8 +67,10 @@
|
||||
mocha.setup('bdd');
|
||||
</script>
|
||||
|
||||
<script src="../lib/openpgp.js"></script>
|
||||
<script src="../lib/forge.min.js"></script>
|
||||
<script src="index.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
mocha.checkLeaks();
|
||||
mocha.globals([]);
|
||||
|
4
test/unit/main.js
Normal file
4
test/unit/main.js
Normal file
@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
// set worker path for tests
|
||||
require('../../src/js/app-config').config.workerPath = '../lib';
|
Loading…
Reference in New Issue
Block a user