When creating a site in a test (or the app), it automatically created a site alongside. This happened even if the factory also specified a task. This created extra tasks in tests which I had to work around in the past, and made tests where the exact tasks were important difficult.
Now, each "siteable" factory (donor, recipient, hub) all create a task (or two in the case of hubs), and a plain site does not. This involved:
- Removing
tasks: [] from site creation (the workaround I used to use
to prevent extra tasks)
- Specifying a specific type of site (donor, recipient, hub)
- Explicitly build tasks in the places that relied on the implicit task
building
And the app now has a SiteService; this takes care of creating a site and it's related tasks so each caller that needs to create a site doesn't have to remember all the steps.
When creating a site in a test (or the app), it automatically created a site alongside. This happened even if the factory also specified a task. This created extra tasks in tests which I had to work around in the past, and made tests where the exact tasks were important difficult.
Now, each "siteable" factory (donor, recipient, hub) all create a task (or two in the case of hubs), and a plain site does not. This involved:
- Removing `tasks: []` from site creation (the workaround I used to use
to prevent extra tasks)
- Specifying a specific type of site (donor, recipient, hub)
- Explicitly build tasks in the places that relied on the implicit task
building
And the app now has a `SiteService`; this takes care of creating a site and it's related tasks so each caller that needs to create a site doesn't have to remember all the steps.