Skip to content

Commit

Permalink
New gulp tesk and increased test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
madureira committed Dec 29, 2014
1 parent ecf9fa8 commit a6ae8fd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
25 changes: 16 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var defineModule = require('gulp-define-module');
var header = require('gulp-header');
var NwBuilder = require('node-webkit-builder');
var coveralls = require('gulp-coveralls');
var clean = require('gulp-clean');



Expand Down Expand Up @@ -170,21 +171,27 @@ gulp.task('watch', function() {
});


// Coverage
gulp.task('coveralls', ['sendToCoveralls'], function() {
return gulp.src('src/javascript/tests/coverage/', {read: false})
.pipe(clean());
});


gulp.task('sendToCoveralls', function() {
return gulp.src('src/javascript/tests/coverage/**/lcov.info')
.pipe(coveralls());
});


// Prepare to tests
gulp.task('prepare', [
'buildTemplates',
'buildJsVendors',
'buildJsSources',
'buidCssVendors',
'buildCssSources']);


// Coverage
gulp.task('coveralls', function() {
gulp.src('src/javascript/tests/coverage/**/lcov.info')
.pipe(coveralls());
});

'buildCssSources'
]);


// default Task
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"gulp-handlebars" : "~3.0.1",
"gulp-define-module" : "~0.1.1",
"gulp-header" : "~1.2.2",
"gulp-clean" : "~0.3.1",
"jshint-stylish" : "~1.0.0",
"jasmine-node-karma" : "~1.6.1",
"karma" : "~0.12.28",
Expand Down
22 changes: 22 additions & 0 deletions src/javascript/tests/engine/Collision.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe("engine/Collision", function() {
var el = document.createElement("div");
el.id = 'stage';
document.body.appendChild(el);

var collision = new App.engine.Collision();

it("should return same position when the target position is blocked", function() {
var fromX = 5;
var fromY = 5;
var toX = 10;
var toY = 10;
var radius = 0.35;
var miniMap = { mapHeight: 8, mapWidth: 8 };
var screen = {};

var newPosition = collision.checkCollision(fromX, fromY, toX, toY, radius, miniMap, screen);

expect(newPosition.x).toEqual(fromX);
});

});

0 comments on commit a6ae8fd

Please sign in to comment.