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
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
so every rule is tested directly, not by adjusting input in cases.