mirror of
https://github.com/moparisthebest/mail
synced 2024-12-21 23:08:50 -05:00
Integration test works again
This commit is contained in:
parent
85afb0be01
commit
84d5bd8124
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,6 +8,6 @@ dist/
|
||||
release/
|
||||
test/integration/src/
|
||||
.elasticbeanstalk/
|
||||
test/unit/index.js
|
||||
test/*/index.js
|
||||
**/*.browserified.js
|
||||
**/*.js.map
|
||||
|
37
Gruntfile.js
37
Gruntfile.js
@ -26,7 +26,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
|
||||
jshint: {
|
||||
all: ['Gruntfile.js', 'src/*.js', 'src/js/**/*.js', 'test/unit/*-test.js', 'test/integration/*.js'],
|
||||
all: ['Gruntfile.js', 'src/*.js', 'src/js/**/*.js', 'test/unit/*-test.js', 'test/integration/*-test.js'],
|
||||
options: {
|
||||
jshintrc: '.jshintrc'
|
||||
}
|
||||
@ -156,17 +156,27 @@ module.exports = function(grunt) {
|
||||
'test/unit/invitation-dao-test.js',
|
||||
'test/unit/update-handler-test.js',
|
||||
'test/unit/connection-doctor-test.js',
|
||||
'test/unit/main.js'
|
||||
'test/main.js'
|
||||
]
|
||||
},
|
||||
options: {
|
||||
external: ['openpgp', 'node-forge', 'net', 'tls', 'crypto']
|
||||
}
|
||||
},
|
||||
integrationTest: {
|
||||
files: {
|
||||
'test/integration/index.browserified.js': [
|
||||
'test/integration/email-dao-test.js',
|
||||
'test/main.js'
|
||||
]
|
||||
},
|
||||
options: {
|
||||
external: ['openpgp', 'node-forge', 'net', 'tls', 'crypto']
|
||||
}
|
||||
}
|
||||
/*
|
||||
TODO:
|
||||
mailreader-worker: {},
|
||||
integrationTest: {}
|
||||
*/
|
||||
},
|
||||
|
||||
@ -220,14 +230,10 @@ module.exports = function(grunt) {
|
||||
'src/lib/angular/angular.min.js',
|
||||
'src/lib/angular/angular-route.min.js',
|
||||
'src/lib/angular/angular-animate.min.js',
|
||||
'src/lib/ngtagsinput/ng-tags-input.min.js',
|
||||
'node_modules/ng-infinite-scroll/build/ng-infinite-scroll.min.js',
|
||||
'node_modules/angularjs/src/ngMock/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',
|
||||
'test/lib/angular-mocks.js',
|
||||
'test/unit/index.browserified.js'
|
||||
]
|
||||
},
|
||||
@ -238,6 +244,23 @@ module.exports = function(grunt) {
|
||||
sourceMapName: 'test/unit/index.js.map'
|
||||
}
|
||||
},
|
||||
integrationTest: {
|
||||
files: {
|
||||
'test/integration/index.js': [
|
||||
'src/lib/underscore/underscore-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',
|
||||
'test/integration/index.browserified.js'
|
||||
]
|
||||
},
|
||||
options: {
|
||||
mangle: false,
|
||||
compress: false,
|
||||
sourceMap: true,
|
||||
sourceMapName: 'test/integration/index.js.map'
|
||||
}
|
||||
},
|
||||
options: {
|
||||
banner: '/*! Copyright © <%= grunt.template.today("yyyy") %>, Whiteout Networks GmbH.*/\n'
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
chrome.app.runtime.onLaunched.addListener(function() {
|
||||
chrome.app.window.create('integration/index.html', {
|
||||
'bounds': {
|
||||
'width': 1024,
|
||||
'height': 768
|
||||
}
|
||||
});
|
||||
});
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
<html style="overflow-y: auto">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JavaScript Unit Tests</title>
|
||||
<title>JavaScript Integration Tests</title>
|
||||
<link rel="stylesheet" href="../lib/mocha.css" />
|
||||
|
||||
</head>
|
||||
@ -10,10 +10,20 @@
|
||||
<div id="mocha"></div>
|
||||
|
||||
<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="../lib/require.js"></script>
|
||||
|
||||
<script>
|
||||
window.expect = chai.expect;
|
||||
mocha.setup('bdd');
|
||||
</script>
|
||||
|
||||
<script src="../lib/openpgp.js"></script>
|
||||
<script src="../lib/forge.min.js"></script>
|
||||
<script src="index.js"></script>
|
||||
|
||||
<script>
|
||||
mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,61 +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;
|
||||
};
|
||||
}
|
||||
|
||||
require(['src/require-config'], function() {
|
||||
require.config({
|
||||
baseUrl: 'src/lib',
|
||||
paths: {
|
||||
'browsercrow': '../../../lib/browsercrow',
|
||||
'browsercrow-envelope': '../../../lib/browsercrow-envelope',
|
||||
'browsercrow-bodystructure': '../../../lib/browsercrow-bodystructure',
|
||||
'browsercrow-mimeparser': '../../../lib/browsercrow-mimeparser',
|
||||
'browsersmtp': '../../../lib/browsersmtp'
|
||||
}
|
||||
});
|
||||
|
||||
// Start the main app logic.
|
||||
require(['js/app-config', 'axe'], function(app, axe) {
|
||||
window.Worker = undefined; // disable web workers since mocha doesn't support them
|
||||
|
||||
app.config.workerPath = '../../src/js';
|
||||
//app.config.cloudUrl = 'http://localhost:8888';
|
||||
|
||||
axe.removeAppender(axe.defaultAppender);
|
||||
|
||||
startTests();
|
||||
});
|
||||
});
|
||||
|
||||
function startTests() {
|
||||
mocha.setup('bdd');
|
||||
|
||||
require(
|
||||
[
|
||||
'../../email-dao-test'
|
||||
], function() {
|
||||
//Tests loaded, run tests
|
||||
mocha.run();
|
||||
}
|
||||
);
|
||||
}
|
50
test/main.js
Normal file
50
test/main.js
Normal file
@ -0,0 +1,50 @@
|
||||
'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;
|
||||
};
|
||||
}
|
||||
|
||||
// a warm round of applause for phantomjs for missing events
|
||||
(function() {
|
||||
if (!window.CustomEvent) {
|
||||
var CustomEvent = function(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;
|
||||
}
|
||||
})();
|
||||
|
||||
// set worker path for tests
|
||||
require('../src/js/app-config').config.workerPath = '../lib';
|
@ -9,55 +9,6 @@
|
||||
<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/mocha.js"></script>
|
||||
<script src="../lib/sinon.js"></script>
|
||||
@ -73,7 +24,7 @@
|
||||
|
||||
<script>
|
||||
mocha.checkLeaks();
|
||||
mocha.globals([]);
|
||||
mocha.globals(['chrome']);
|
||||
mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
|
@ -1,4 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// set worker path for tests
|
||||
require('../../src/js/app-config').config.workerPath = '../lib';
|
Loading…
Reference in New Issue
Block a user