Render list results in CQL list syntax in the results file - #107
Merged
Conversation
List-typed actual values were flattened with String(), so a list like
['@2012-01-01T', '@2012-01-01T12'] appeared in the results JSON as the
comma-joined string '@2012-01-01T,@2012-01-01T12', obscuring the list
structure (and hiding that only element order differed from expected).
Format array actuals as '{ a, b, c }' (recursively, '{}' when empty) so
the actual value reads like the expected value's CQL/CVL notation.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M6fK2KhnNsn28SJfe83Htw
There was a problem hiding this comment.
Pull request overview
Improves readability of generated CQL test results by rendering array-typed actual values using CQL list syntax ({ a, b, c }, recursive for nested lists, {} for empty lists) instead of the prior flattened String() output, while keeping the actual field as a plain string to avoid schema/consumer changes.
Changes:
- Added a
formatActualValuehelper to serialize array actuals into CQL list syntax (with recursion for nested lists). - Updated
toJSONandequalizeValueTypesto useformatActualValuewhen producing schema-compliant stringactualvalues. - Added unit tests covering scalar, list, nested-list, and empty-list formatting behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/test-results/cql-test-results.ts |
Adds formatActualValue and uses it to preserve list structure in actual when serializing results. |
test/cql-test-results-validator.test.ts |
Adds tests validating list/scalar/nested/empty list formatting for toJSON and equalizeValueTypes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bryantaustin13
approved these changes
Jul 29, 2026
bryantaustin13
left a comment
Contributor
There was a problem hiding this comment.
Approved. Improves readability.
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.
List-typed actual values were flattened with
String()when writing the results file, so a list like['@2012-01-01T', '@2012-01-01T12']appeared as the comma-joined string@2012-01-01T,@2012-01-01T12. That obscures the list structure and makes failures hard to read — e.g. forCqlListOperatorsTest / Sort / SortDatesAsc, the only difference from the expected value was element order, which was invisible in the flattened form.Changes
src/test-results/cql-test-results.ts: added aformatActualValuehelper that renders array actuals in CQL list syntax —{ a, b, c }, recursing into nested lists,{}for empty lists — so the actual value reads like the expected value's CQL/CVL notation. Non-array objects fall back toJSON.stringify, scalars toString()as before. Used by bothtoJSONandequalizeValueTypes.actualremains a plain string, so the results JSON schema and downstream consumers of results files are unaffected.Before / after for
SortDatesAsc:Note: string elements are not re-quoted (a CQL
{ 'a', 'b' }renders as{ a, b }), since the extracted values no longer carry type information. This only affects display in the results file; pass/fail comparison happens before formatting and is unchanged.Testing
toJSONandequalizeValueTypes.tsc --noEmitis clean.run-testsagainst a mock FHIR server returning repeatedreturnparameters — the results file shows the CQL-list-formatted actual above.🤖 Generated with Claude Code
https://claude.ai/code/session_01M6fK2KhnNsn28SJfe83Htw
Generated by Claude Code