Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 2
    This is a very brittle approach. You have a lot of copy-paste that is easy to mess up when modifying, and any tests you run with dryRun==true are not actually testing your bussiness logic. It is way better than having 2 separate functions, but not a robust approach. Commented Jan 27, 2022 at 20:55
  • Admittedly, it can be improved by putting the dryRun boolean check in the sendCoupon() function itself, if it's using a configuration global value, but it would allow you to be explicit about what parts of a function are, in fact, dangerous to run without checking that it's working as expected. Commented Jan 27, 2022 at 22:28