Test/PROD-1439 duplicate content mapping guards#151
Open
5PK wants to merge 1 commit into
Open
Conversation
Add unit tests covering the two guards introduced in PR #143 (PROD-1439): - content-item-mapper: throws on a duplicate mapping attempt where the source is already mapped to a different target - getContentItemTypes: an item already promoted to linkedSet is not re-added to normalSet on its own loop iteration
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
Adds unit tests for the two duplicate-mapping guards introduced in PR #143 (Jira ticket PROD-1439).
Tests added
src/lib/mappers/tests/content-item-mapper.test.tsContentItemMapper.addMappingthrows'Aborting a duplicate mapping attempt'when a source content item (ID 10) that is already mapped to a target (ID 20) is subsequently mapped to a different, previously-unmapped target (ID 99). This guards against silent data corruption where one source would end up pointing to multiple targets.src/lib/pushers/content-pusher/util/tests/get-content-item-types.test.tsnormalContentItems. The test asserts thatlinkedItemappears exactly once inlinkedContentItemsand is absent fromnormalContentItems.Related
Test plan
yarn test src/lib/mappers/tests/content-item-mapper.test.ts— new test passesyarn test src/lib/pushers/content-pusher/util/tests/get-content-item-types.test.ts— new test passesyarn test)🤖 Generated with Claude Code