this post was submitted on 28 Oct 2024
3 points (100.0% liked)

JavaScript

19 readers
1 users here now

founded 1 year ago
MODERATORS
 

Generally, it is inadvisable to directly expect in if-clauses. Here are some tips to avoid these situations.

top 2 comments
sorted by: hot top controversial new old
[โ€“] kSPvhmTOlwvMd7Y7E@programming.dev 1 points 3 weeks ago (1 children)

Don't write "if" in your tests! It makes very, very little sense: how is that, you test your application and you are unsure what is the resulting outcome of a call? Is it depending on arguments? Then fix the argument, and expect 1 specific result. Is it depending on environment? Fix/mock the environment.

No "ifs" in the tests!

[โ€“] 8hob@programming.dev 3 points 3 weeks ago

The post talks about how to avoid ifs ;)