diff --git a/.travis.yml b/.travis.yml index 7caf3cd..266449a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - "node" - "iojs" +services: + - xvfb before_script: - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start diff --git a/package.json b/package.json index 7d46b91..323dc54 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,11 @@ }, "homepage": "https://github.com/ahmednuaman/javascript-tests", "dependencies": { - "karma": "^0.12.32", - "karma-jasmine": "^0.3.5", - "karma-phantomjs-launcher": "^0.1.4" - }, + "jasmine-core": "2.99.0", + "karma": "0.13.22", + "karma-jasmine": "0.3.8", + "karma-phantomjs-launcher": "1.0.4" +}, "devDependencies": { "karma-chrome-launcher": "^0.1.12", "karma-firefox-launcher": "^0.1.6" diff --git a/test/clone-object.js b/test/clone-object.js index 86ec647..5afc49b 100644 --- a/test/clone-object.js +++ b/test/clone-object.js @@ -3,6 +3,8 @@ describe('clone object', function () { var expected = {name: 'Ahmed', age: 27, skills: ['cycling', 'walking', 'eating']}, obj = {}; + obj = JSON.parse(JSON.stringify(expected)); + expect(obj).toEqual(expected); expect(obj).not.toBe(expected); }); diff --git a/test/flatten-array.js b/test/flatten-array.js index c7f0632..04f15e6 100644 --- a/test/flatten-array.js +++ b/test/flatten-array.js @@ -3,6 +3,11 @@ describe('flatten array', function () { var arr = [1, 2, [1, 2, [3, 4, 5, [1]]], 2, [2]], expected = [1, 1, 1, 2, 2, 2, 2, 3, 4, 5]; + const arrAsString = arr.toString(); + const flatArr = arrAsString.split(',').map(Number); + + arr = flatArr.sort(); + expect(arr).toEqual(expected); }); -}); \ No newline at end of file +}); diff --git a/test/scoping.js b/test/scoping.js index 557c54a..76b0c90 100644 --- a/test/scoping.js +++ b/test/scoping.js @@ -16,9 +16,9 @@ describe('scoping', function () { }; Module.prototype.req = function() { - return request(this.method); + return request(this.method.bind(this)); }; expect(mod.req()).toBe('bar'); }); -}); \ No newline at end of file +});