Repository navigation
test(web): give the retried map's container a size in the pin test - #726
Merged
Merged
Conversation
The test that replaces the map gave the replacement a fake container without getBoundingClientRect. The visible label is fitted against the container on the next animation frame. The test usually unmounted first, which cancels that frame, but on a slow runner the frame ran and threw outside the test, and Vitest failed the web run with an unhandled error. The replacement container now has the same size as the first map's, and the test waits for that frame before it unmounts, so it always runs the fit on the replacement map.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What changed and why
test (web)failed on #719, which touches no web code. All 5,664 tests passed, but Vitest reported an unhandled error fromapps/web/src/hooks/usePinMarker.test.tsx:The cause is the test "reattaches the pin after the map is replaced by a retry":
getBoundingClientRect. Only the first map's container is given one at the top of the file.The hook itself does cancel its pending frame on cleanup, so this is a test-only race.
The replacement container now gets the same size as the first. The test also waits for one animation frame before unmounting, as the other label tests in the file do, so it always runs the fit on the replacement map instead of racing it.
Verification
pnpm exec vitest run --project web: 601 files, 5,667 tests, no errors. Biome passes.Release and upgrade impact
Product impact: ordinary