From f4ac5dfe8ce7488e97f5dcc550e6266c4f87d024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Jureti=C4=87?= Date: Thu, 31 Oct 2013 22:30:25 -0300 Subject: [PATCH] fix unit tests --- .travis.yml | 3 ++- karma.conf.js | 4 ++-- package.json | 2 +- test/spec/userServicesSpec.js | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83f4e22f0af..9f977e25052 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: node_js node_js: - - '0.8' - '0.10' before_script: - 'npm install -g bower grunt-cli' - 'bower install' + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start diff --git a/karma.conf.js b/karma.conf.js index 59aff0d276c..17f008426c1 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -35,7 +35,7 @@ module.exports = function(config) { // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, + autoWatch: true, // Start these browsers, currently available: @@ -46,7 +46,7 @@ module.exports = function(config) { // - Safari (only Mac) // - PhantomJS // - IE (only Windows) - browsers: ['Chrome'], + browsers: ['Firefox'], // Continuous Integration mode diff --git a/package.json b/package.json index 15d13a6fe38..6bedefae7f3 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "npm": "1.2.x" }, "scripts": { - "test": "mocha test/api.mocha.coffee", + "test": "grunt karma", "start": "grunt run:dev", "postinstall": "./node_modules/bower/bin/bower install -f" }, diff --git a/test/spec/userServicesSpec.js b/test/spec/userServicesSpec.js index fa2c12a6df9..d4e11d8f527 100644 --- a/test/spec/userServicesSpec.js +++ b/test/spec/userServicesSpec.js @@ -7,7 +7,8 @@ describe('userServices', function() { beforeEach(function(){ module(function($provide){ - $window = {href: '', alert: sinon.spy(), location: {search: '', pathname: ''}}; + var habitrpgShared = {helpers: {newUser: sinon.spy()}}; + $window = {href: '', alert: sinon.spy(), location: {search: '', pathname: ''}, habitrpgShared: habitrpgShared}; $provide.value('$window', $window); });