Skip to content

Commit

Permalink
Update ported JR indexed-repeat tests for consistent XPath referenc…
Browse files Browse the repository at this point in the history
…e usage

As was done in the first pass on this functionality in #150
  • Loading branch information
eyelidlessness committed Aug 20, 2024
1 parent 6e2cf9d commit aad995b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/scenario/test/xpath/functions/indexed-repeat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ describe('Tests ported from JavaRosa', () => {
* lets you reference `group` (the class property) and `group` (the
* imported static method) in the same scope. TypeScript/JavaScript don't
* let you do that... which is fine, because doing that is really weird!
*
* - `answer` calls updated to omit superfluous position predicate on
* the non-repeat `some-group` step (we do this lookup by `reference`,
* not evaluating arbitrary XPath expressions to identify the question
* being answered).
*/
it.fails.each<IndexedRepeatRelativeRefsOptions>(parameters)('$testName', async (options) => {
const scenario = await Scenario.init(
Expand Down Expand Up @@ -134,9 +139,14 @@ describe('Tests ported from JavaRosa', () => {
)
);

scenario.answer('/data/some-group[1]/item[1]/value', 11);
scenario.answer('/data/some-group[1]/item[2]/value', 22);
scenario.answer('/data/some-group[1]/item[3]/value', 33);
// scenario.answer('/data/some-group[1]/item[1]/value', 11);
scenario.answer('/data/some-group/item[1]/value', 11);

// scenario.answer('/data/some-group[1]/item[2]/value', 22);
scenario.answer('/data/some-group/item[2]/value', 22);

// scenario.answer('/data/some-group[1]/item[3]/value', 33);
scenario.answer('/data/some-group/item[3]/value', 33);

expect(scenario.answerOf('/data/total-items')).toEqualAnswer(intAnswer(3));
expect(scenario.answerOf('/data/some-group/last-value')).toEqualAnswer(intAnswer(33));
Expand Down

0 comments on commit aad995b

Please sign in to comment.