test(cqn4sql): refactor calculated elements test suite - #1643
Open
patricebender wants to merge 6 commits into
Open
test(cqn4sql): refactor calculated elements test suite#1643patricebender wants to merge 6 commits into
cqn4sql): refactor calculated elements test suite#1643patricebender wants to merge 6 commits into
Conversation
Split the monolithic calculated-elements.test.js (1,254 lines, 76 tests) into a calculated-elements.test/ directory with topic-based spec files, mirroring the pattern from assoc2join.test/, exists.test/, and nested-projections.test/. - select-list.spec.js (50 tests) - other-places.spec.js (17 tests) - localized.spec.js (4 tests) - exists.spec.js (2 tests) - drafts.spec.js (2 tests) - stored.spec.js (1 test) Adopt the shared loadModel/expectCqn helpers, rename query → transformed, and indent cds.ql template literals to match the surrounding JS context. The localized describe verifies the SELECT.localized flag with a separate standard assertion since expectCqn's normalize drops inherited enumerable props.
patricebender
requested review from
BobdenOs,
danjoa,
johannes-vogel,
sjvans and
stewsk
as code owners
June 11, 2026 15:19
Rename other-places.spec.js → outside-select-list.spec.js and fold the two exists tests into it as a nested describe — they're a special case of calc elements unfolding outside the select list, not a standalone topic worth its own file.
patricebender
marked this pull request as draft
June 11, 2026 15:32
The placement-based split (`select-list` vs `outside-select-list`)
mixed several distinct concerns inside a single 889-line file. Reorganize
into content-focused specs, each grouping tests by the unfolder aspect
they exercise:
- basics.spec.js - trivial alias/val/scalar xpr
- nesting.spec.js - calc element references calc element
- functions.spec.js - function calls, named params, native fns
- ternary.spec.js - CASE / ternary unfolding
- joins.spec.js - join generation (incl. nested describe
for join-node reuse)
- filters.spec.js - infix filters in / on calc elements
- exists.spec.js - EXISTS-rejection + calc-elem-with-exists
- variable-replacements.spec.js - $now / $user preservation
- wildcard.spec.js - {*} / excluding interactions
- nested-projections.spec.js - inline / expand / subquery
- placements.spec.js - where/from/group by/having/order by
Test bodies are moved verbatim; no semantics changed.
patricebender
marked this pull request as ready for review
June 21, 2026 11:15
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.
Splits the 1,254-line
calculated-elements.test.jsinto acalculated-elements.test/directory of topic-based specs, grouped by what aspect of the unfolder each test exercises:basics,nesting,functions,ternary,joins(with ajoin node reusedescribe),filters,exists,variable-replacements,wildcard,nested-projections,query-clauses, pluslocalized,drafts, andstored.Test bodies are moved verbatim — no semantic changes. Same 75 passing + 1 pre-existing skip as before.