Use should.eql to compare arrays
When trying to pass the "Return Largest Numbers in Arrays" challenge, I seem to be unable to pass the provided tests. I'm not familiar with Chai, but it would seem that we need to switch to .eql rather than === or should.equal when comparing two arrays to deeply compare the values rather than comparing objects.
This commit is contained in:
@ -124,8 +124,8 @@
|
|||||||
"challengeSeed": "function largestOfFour(arr) {\n // You can do this!\r\n return arr;\r\n}",
|
"challengeSeed": "function largestOfFour(arr) {\n // You can do this!\r\n return arr;\r\n}",
|
||||||
"tests": [
|
"tests": [
|
||||||
"expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');",
|
"expect(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).to.be.a('array');",
|
||||||
"(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.equals([5,27,39,1001]);",
|
"(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]])).should.eql([5,27,39,1001]);",
|
||||||
"assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) === [9,35,97,1000000]);"
|
"assert(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]).should.eql([9,35,97,1000000]));"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user