Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Generated on Wed Jun 18 2014 09:33:44 GMT+0100 (BST)

module.exports = function(config) {
var browsers = ['PhantomJS', 'Firefox'];
var browsers = ['Firefox'];

if (!process.TRAVIS) {
browsers.push('Chrome');
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
},
"homepage": "https://github.com/ahmednuaman/javascript-tests",
"dependencies": {
"karma": "^0.12.32",
"karma-jasmine": "^0.3.5",
"karma-phantomjs-launcher": "^0.1.4"
"karma-jasmine": "^4.0.1",
"karma-phantomjs-launcher": "^1.0.4",
"karma": "^6.3.2"
},
"devDependencies": {
"karma-chrome-launcher": "^0.1.12",
"karma-firefox-launcher": "^0.1.6"
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^2.1.0"
}
}
4 changes: 2 additions & 2 deletions test/clone-object.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
describe('clone object', function () {
it('should clone an object', function () {
var expected = {name: 'Ahmed', age: 27, skills: ['cycling', 'walking', 'eating']},
obj = {};

obj = {...expected};
expect(obj).toEqual(expected);
expect(obj).not.toBe(expected);
});
Expand Down
16 changes: 15 additions & 1 deletion test/flatten-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@ describe('flatten array', function () {
it('should flatten an 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 flattenArray = (arr) => {
someNewArray = arr.reduce((acc, item)=>{
if(Array.isArray(item)){
acc = acc.concat(flattenArray(item))
}
else{
acc = [...acc, item]
}
return acc
},[])
return someNewArray.sort()
}

arr = flattenArray(arr)
expect(arr).toEqual(expected);
});
});
2 changes: 1 addition & 1 deletion test/scoping.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('scoping', function () {
};

Module.prototype.req = function() {
return request(this.method);
return request(this.method.bind(this));
};

expect(mod.req()).toBe('bar');
Expand Down