Make Your Test Fail

Kent C. Dodds
InstructorKent C. Dodds

Share this video with your friends

Send Tweet

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
~ a year 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
~ a year ago

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