You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tests for `monorepo-workflow-utils.ts` are not as readable or
maintainable as I'd like them to be. This commit attempts to fix that:
* While there isn't a whole lot we can do in terms of the scenarios
we're testing because the function makes a lot of calls and the logic
inside of it is somewhat complicated, we can at least move
`captureChangesInReleaseBranch` out into a separate file so that we
don't have to create so much data for each test.
* We also simplify the structure of the tests so that we aren't using so
many nested `describe` blocks. This ends up being very difficult to
keep straight in one's head, so the flattened layout here makes it a
little more palatable.
* Finally, we simplify the setup code for each test. Currently we are
mocking all of the dependencies for `followMonorepoWorkflow` in one
go, but we're doing so in a way that forces the reader to wade through
a bunch of type definitions. That isn't really that helpful. The most
complicated part of reading the tests for `followMonorepoWorkflow`
isn't the dependencies — it's the logic. So we take all of the
decision points we have to make in the implementation and represent
those as options to our setup function in the tests so it's as clear
as possible which exact scenario is being tested just by reading the
test.
0 commit comments