Beta
Bầu cua tôm cá
21Huongg
Loading description...
Fundamentals
Arrays
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Test block
Should return a non-empty map of player names to the sum of their winnings (or losses)
has no test assertions:Test.expect
is missing.The title should be in english
Test.expect
should be removedNode 12 should be enabled
The use of
Test.expect
here is fine: it's just checking if the return value is truthy. Checking of actual values are done viaTest.assertDeepEquals
.assertSimilar
should be replaced withassertDeepEquals
in the sample tests.There're
undefined
's in the random inputs.Needs random tests
Yes
Hi guys, I've added random test to my kata. Thanks for the advice
Please do not use
assertSimilar
; useassertDeepEquals
instead.Hi Johan, Thanks for the recommendation. I was going to use assertEquals but did some reasearch about assertDeepEquals. It seems like a better choice.
Just wanted to ask you, from my understanding, assertDeepEquals check if the result is equivalent with expected output, even though they're not the same object. Is there any other reason why you suggested using assertDeepEquals?
Thank you
Success and failure messages from
assertDeepEquals
are a lot cleaner than those ofassertSimilar
.Also,
assertDeepEquals
ignores property order withinObject
s;assertSimilar
does not. Property order is sometimes undefined in JavaScript, so testing should not depend on it.assertEquals
is not going to work withObject
s; it compares references, not values.thanks for the advice. Very appreciate that