Skip to content

Commit

Permalink
Merge pull request #2 from llipio/master
Browse files Browse the repository at this point in the history
merging solution llipio#16
  • Loading branch information
msach22 authored Apr 27, 2017
2 parents 9fe3d3a + ffa318c commit beaddaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions solutions/16.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//msach22
// should return true if the input array has duplicant element values
// should return true if the input array has duplicate values and false if it doesn't

const hasDuplicates = (array) => {
let map = {};
Expand All @@ -12,8 +12,6 @@ const hasDuplicates = (array) => {
return false;
}

array = [1,2,3];

module.exports = {
hasDuplicates
};
9 changes: 3 additions & 6 deletions test/16.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ const hasDuplicates = duplicates.hasDuplicates;
describe('check duplicates', () => {
it('should return true since array has duplicates', () => {
const array = [1,2,3,3,4];
const expected = true;
expect(hasDuplicates(array)).eql(expected);
expect(hasDuplicates(array)).to.be.true;
});
it('should return false because array does not have duplicates', () => {
const array = [1,2,3,4];
const expected = false;
expect(hasDuplicates(array)).eql(expected);
expect(hasDuplicates(array)).to.be.false;
});
it('should return false because array is empty', () => {
const array = [];
const expected = false;
expect(hasDuplicates(array)).eql(expected);
expect(hasDuplicates(array)).to.be.false;
});
});

0 comments on commit beaddaf

Please sign in to comment.