Remove setting return cycle in ReturnLogHelper #1398
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When attempting to run the acceptance tests we found most of them were now failing. After investigating we tracked it down to a recent change made to the
ReturnLogHelper
.We started setting
returnCycleId
to a generated UUID. Normally, return logs have this set to the return cycle they fall within. However, if it is set (in the DB proper) the ID must exist inreturn.return_cycles
.We've opted not to replicate foreign key constraints in our test DB legacy migrations because of the additional complexity they would add to our unit tests, for something we don't need to cover in them.
It wasn't being set before, because our premise for the helpers is they set only what is required in order to insert a record. Any fields that are 'optional', are expected to be set within the test using the helper and passed in.
Fortunately, removing the call in the helper hasn't broken any existing tests, further highlighting we don't really need this defaulted for what we are testing. And removing the call gets the acceptance tests passing again!