Open JEdward7777 opened 8 months ago
Finally getting to this. The error in the test has nothing to do with adding a verse - not adding a verse results in the same error.
The error is Error: 2 input(s) expected by usfmToPerfPipeline but 1 provided (usfm)
and appears to be accurate. You're using a pipeline that expects 2 inputs but only giving it one, and that pipeline isn't the one that does splitting or merging.
The missing input is "selectors" which sounds like it wants the Proskomma document selectors.
This is why it would be better if we could do this using Epitelete, which is supposed to have a workflow corresponding to these pipelines.
The next problem is that you were passing
{
perf: {
perf: {
schema: [Object],
metadata: [Object],
sequences: [Object],
main_sequence_id: 'ZmQwNWNmY2Ut'
}
}
}
into the pipeline. If I pull .perf
out of that the pipeline works.
And now, having also made the pipeline handler errors a lot more informative, the pipeline works without a new verse but, with a new verse, I get
Cannot read properties of undefined (reading 'after--Testing--1--1')
which I think is the thing we were initially trying to debug, and which still looks trivial to fix. (Famous last words...)
Sure enough, the error is around
const markup = strippedAlignment[chapter][verses];
If there's no record for the verse, markup is undefined, and then the first lookup inside markup croaks.
And
const markup = strippedAlignment[chapter][verses] || {};
fixes it.
Finally,
t.same(output.perf, JSON.parse(perfContent))
will always fail because PERF uses UIDs for sequence names and they cannot be preserved when roundtripping via USFM.
When using the split merge workflow, the merge fails if an extra verse was added to the stripped usfm. A test showing this error is here: 5ed03d472a2fbe1d3401908d1b17e09d263eda35