chore: add missing unit tests for isNotNull and lineage edge cases in cht-datasource#11062
Open
shivv23 wants to merge 4 commits into
Open
chore: add missing unit tests for isNotNull and lineage edge cases in cht-datasource#11062shivv23 wants to merge 4 commits into
shivv23 wants to merge 4 commits into
Conversation
…nifyDoc edge cases
…nifyDoc edge cases
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 missing unit test coverage for the
isNotNulltype guard and edge cases for lineage utility functions in the@medic/cht-datasourceshared library.Details
Based on a test coverage audit of the cht-datasource library, the following gaps were identified and filled:
1.
isNotNulltype guard — 8 test casesshared-libs/cht-datasource/src/libs/core.tsHad zero direct unit tests despite being an exported type guard used across the library (
filter(isNotNull)appears in multiple lineage functions). Added 8 parameterized cases:nullfalseundefinedfalse(type guard passes, no narrowing)'value'true0true''truefalsetrue{}true[]true2.
getLineageDocsByIdedge cases — 3 testsHad only 1 happy-path test. Added:
3.
minifyLineageedge cases — 3 testsAdded tests for:
parent.name,typeremoved, only_id+parent._idkept)4.
minifyDocedge cases — 3 testsAdded tests for:
All tests follow the existing patterns: chai expectations, sinon stubs, and async/await where needed.
Testing