fix(api): await every seeded dog in the suggestion preference tests - #297
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The color and size preference tests in the suggestion service suite raced against their own fixture setup, so they sometimes counted dogs that had not finished being created yet.
Details
Array.from({ length }).map(...)promises as a single array element insidePromise.all, instead of spreading them, soPromise.alldid not wait for that batch to resolve....Array.from(...)so every seeded dog is awaited before the assertions run.new Date()in JS while the service compares ages using SQLNOW(), so there is a theoretical year boundary gap between the two. The service has no injectable clock to pin against, so this is left as is; the gap only matters if the suite happens to run at the exact moment a fixture crosses a year mark, which is not the source of the observed flakiness.Testing steps
Screenshots
Not applicable