Parameterize the repeated test cases before they get copied again
There are a few places where separate test functions call the same helper with the same arguments. The tests aren't exposing a regression and I don't think the assertions are wrong. This is mostly a DRY cleanup before the next variation gets added by copying another wrapper.
I found nine clusters:
- apply runner: three identical targeted plan-in-flight cases, two identical stale-base automerge cases, and two identical ignored-target cases (examples)
- DB updater: two names for the same same-head/different-base failure case (tests and here)
- project command builder: two identical no-plan/empty-status cases (tests)
- project command runner: three identical plan-mutation cases and two identical stale-command classification cases (mutation cases, classification cases)
- Bitbucket Cloud and Bitbucket Server each have two identity tests that call the same helper with no different setup (Cloud, Server)
Some of the names describe slightly different intentions, but because the bodies and inputs are the same they aren't actually separate coverage. If the shared helper changes, all of the named scenarios still move together.
I think we should parameterize the cases where there are real input variations, and collapse the aliases where there aren't. That'll make it more obvious what behavior is distinct and give the next test case a natural place to add its actual input instead of another copied function.
Source: runatlantis/atlantis