This commit is contained in:
Christoph Wurst 2015-09-01 17:20:08 +02:00
Родитель b800956826
Коммит 97a0164445
7 изменённых файлов: 45 добавлений и 10 удалений

Просмотреть файл

@ -33,12 +33,14 @@ before_script:
- cd apps/mail
- npm install --deps
- npm run-script bower_deps
- ./node_modules/.bin/grunt
script:
# Test lint
- find . -name \*.php -not -path './vendor/*' -exec php -l "{}" \;
# Run js unit tests
- grunt
# Run phpunit tests
- cd tests
- phpunit --configuration phpunit.xml

Просмотреть файл

@ -24,16 +24,28 @@ module.exports = function(grunt) {
config: '.jscsrc',
verbose: true
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
autoWatch: true
},
continuous: {
configFile: 'karma.conf.js',
browsers: ['PhantomJS'],
singleRun: true,
}
}
});
// jscs
grunt.loadNpmTasks('grunt-jscs');
// jshint
grunt.loadNpmTasks('grunt-contrib-jshint');
// Karma unit tests
grunt.loadNpmTasks('grunt-karma');
// Default task
grunt.registerTask('default', ['jscs', 'jshint']);
grunt.registerTask('default', ['jscs', 'jshint', 'karma:continuous']);
};

Просмотреть файл

@ -9,9 +9,12 @@
*/
define(['models/account'], function(Account) {
describe("test nothing", function() {
it("should be able to initialize", function() {
expect(1).toEqual(10);
describe("test tests", function() {
it("should pass", function() {
expect(1).toEqual(1);
});
it("should also pass", function() {
expect(2).toEqual(2);
});
});
});

17
js/tests/mocks/OC.js Normal file
Просмотреть файл

@ -0,0 +1,17 @@
/**
* ownCloud - Mail
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @copyright Christoph Wurst 2015
*/
define(function() {
return {
generateUrl: function(url, params) {
return '/app/mail/' + url;
}
};
});

Просмотреть файл

@ -19,7 +19,8 @@ require.config({
backbone: 'vendor/backbone/backbone',
domready: 'vendor/domready/ready.min',
handlebars: 'vendor/handlebars/handlebars',
marionette: 'vendor/backbone.marionette/lib/backbone.marionette'
marionette: 'vendor/backbone.marionette/lib/backbone.marionette',
OC: 'tests/mocks/OC'
},
shim: {
handlebars: {

Просмотреть файл

@ -9,13 +9,12 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
'../../core/js/js.js',
'../../core/js/oc-dialogs.js',
'../../core/vendor/underscore/underscore.js',
'../../core/vendor/jquery/jquery.min.js',
'../../core/vendor/handlebars/handlebars.js',
{pattern: 'js/*/*.js', included: false},
{pattern: 'js/vendor/backbone/backbone.js', included: false},
{pattern: 'js/tests/mocks/*.js', included: false},
{pattern: 'js/tests/TestSpec.js', included: false},
'js/tests/test-main.js',
],

Просмотреть файл

@ -41,6 +41,7 @@
"requirejs": "^2.1.20"
},
"dependencies": {
"grunt-karma": "^0.12.0",
"karma-cli": "^0.1.0",
"phantomjs": "^1.9.18"
}