Hacker News new | ask | show | jobs
by tennis_80 1220 days ago
My team use GIVEN X AND Y SHOULD Z

It works nicely with Jest as you can nest test suites indefinitely, so each GIVEN statement goes in a nested describe block, but it is verbose.

1 comments

GIVEN X and Y SHOULD Z works, but don't you think that it lowers the meaning of the statement; essentially you're putting Y SHOULD Z in a conditional? Y SHOULD Z would work better, right?
We do exactly this for the happy paths. GIVEN steps are for preconditions to get into the unhappy paths