platform: data-driven selection tests for USJ <-> Lexical conversion#456
Merged
irahopkinson merged 1 commit intomainfrom Mar 9, 2026
Merged
platform: data-driven selection tests for USJ <-> Lexical conversion#456irahopkinson merged 1 commit intomainfrom
irahopkinson merged 1 commit intomainfrom
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders Open Preview |
Add 612 data-driven tests (136 USJ locations x 3 marker modes + round-trips)
for selection resolution and round-trip conversion between USJ document
locations and Lexical editor selections.
Test data:
- 2sa.usj-locations.ts: 136 location entries adapted from paranext-core's
testUSFM-2SA-1-locations.ts covering all 7 UsjDocumentLocation subtypes
- 2sa.lexical.{editable,visible,hidden}.ts: pre-generated serialized Lexical
editor states for `usj2Sa` in each marker mode
Known implementation gaps are tracked with `expect(() => ...).toThrow()`
inside regular `it()` tests so they stay visible without breaking CI or
the VS Code test explorer. When a gap is fixed the `toThrow()` assertion
fails, prompting removal of the entry from the KNOWN_*_GAPS set.
Generation:
- generate-2sa-lexical-states.test.ts guarded by GENERATE_TEST_DATA env var
(skipped during normal nx test runs)
- pnpm generate:test-data in packages/platform to regenerate fixtures
Also adds test-data as a devDependency of shared-react and excludes the
auto-generated Lexical state fixtures from SonarLint analysis.
tjcouch-sil
approved these changes
Mar 5, 2026
Contributor
tjcouch-sil
left a comment
There was a problem hiding this comment.
Very nice!! Just one question about the tests.
libs/shared-react/src/plugins/usj/annotation/selection.utils.data-driven.test.ts
Show resolved
Hide resolved
Contributor
|
Thanks! Merge when ready |
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.
Add 612 data-driven tests (136 USJ locations x 3 marker modes + round-trips) for selection resolution and round-trip conversion between USJ document locations and Lexical editor selections.
Test data:
usj2Sain each marker modeKnown implementation gaps are tracked with
expect(() => ...).toThrow()inside regularit()tests so they stay visible without breaking CI or the VS Code test explorer. When a gap is fixed thetoThrow()assertion fails, prompting removal of the entry from the KNOWN_*_GAPS set.Generation:
Also adds test-data as a devDependency of shared-react and excludes the auto-generated Lexical state fixtures from SonarLint analysis.
This change is