Make Your Test Fail

Kent C. Dodds
InstructorKent C. Dodds
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 4 years ago

If you're not careful you can write a test that's worse than having not tests at all. In this lesson we'll learn why that is and how you can avoid it by making sure your test can fail.

This is based on my blog post: Make Your Test Fail

HaveF
HaveF
~ 5 years ago

what about testing each rule separately. eg

hasDigits :  (string) => boolean
hasUpperCase,
longEnough,

write the positive and negative cases for each rule.

then compose rules in isPasswordAllowed, at last, add some accept cases for isPasswordAllowed

HaveF
HaveF
~ 5 years ago

so every rule is tested directly, not by adjusting input in cases.

Markdown supported.
Become a member to join the discussionEnroll Today