Skip to content

Commit

Permalink
Port CurrentFieldRefTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
eyelidlessness committed May 16, 2024
1 parent 982c66d commit 25b6387
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/scenario/test/xpath/functions/current.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { describe, expect, it } from 'vitest';
import { stringAnswer } from '../../../src/answer/ExpectedStringAnswer.ts';
import { Scenario } from '../../../src/jr/Scenario.ts';

describe('XPath function support: `current`', () => {
describe('CurrentFieldRefTest.java', () => {
describe('`current()` in a field ref', () => {
/**
* **PORTING NOTES**
*
* - JavaRosa performs {@link Scenario} initialization in a `@Before` ...
* `setUp` method. It's unclear why, for a single test (maybe there's a
* pattern across similar tests?). We initialize the scenario directly
* in the test body for test clarity.
*
* - Is this... a thing? Failing pending feature support, if it turns out
* to be something we want to support.
*/
it.fails('should be the same as a relative ref', async () => {
const scenario = await Scenario.init('relative-current-ref-field-ref.xml');

// The ref on /data/my_group[1]/name uses current()/name instead of an absolute path
scenario.answer('/data/my_group[1]/name', 'Bob');
scenario.answer('/data/my_group[2]/name', 'Janet');

expect(scenario.answerOf('/data/my_group[1]/name')).toEqualAnswer(stringAnswer('Bob'));

expect(scenario.answerOf('/data/my_group[2]/name')).toEqualAnswer(stringAnswer('Janet'));
});
});
});
});

0 comments on commit 25b6387

Please sign in to comment.