Skip to content

test: achieve 100% branch coverage in ParsingContext#146

Merged
rubensworks merged 1 commit into
masterfrom
copilot/increase-test-coverage-100
Apr 1, 2026
Merged

test: achieve 100% branch coverage in ParsingContext#146
rubensworks merged 1 commit into
masterfrom
copilot/increase-test-coverage-100

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Branch coverage was at 99.87% due to the else path of if ('@id' in contextKeyEntry) in ParsingContext.getContext never being exercised — all existing property-scoped context tests included an @id on the scoped entry.

Change

Added a test case where a property-scoped context entry has @context but no @id, covering the previously untested branch:

// ParsingContext.ts:250 — previously only the true branch was hit
if ('@id' in contextKeyEntry) {
  contextRaw[key]['@id'] = contextKeyEntry['@id'];
}

The new test sets up a root context with a property a that carries a @context sub-context but no @id, then asserts that getContext resolves with the scoped vocab and an empty entry for a.

@rubensworks rubensworks marked this pull request as ready for review April 1, 2026 09:20
@rubensworks rubensworks merged commit b787d50 into master Apr 1, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants