Skip to content

test: reach 100% coverage and fix navigation for parents without question - #2

Merged
devCrossNet merged 2 commits into
mainfrom
test/full-coverage
Oct 8, 2026
Merged

devCrossNet merged 2 commits into
mainfrom
test/full-coverage

Conversation

@devCrossNet

Copy link
Copy Markdown
Owner

What is accomplished by your PR?

Bug fix

getNavigation() threw a TypeError when a parent navigation item had no own question, but its children had. setActiveQuestionByNavigationItemId already supports this case. Now the parent is shown and hasValue / isValid are derived from its children. Parents without any question are still skipped.

Tests (19 → 28, coverage 100%)

  • Move examples/misc.spec.ts to src/quaire.spec.ts (unit test, not an example) and add edge case tests: unknown question/navigation IDs, saving without active question, validation, navigation items without questions, restore without items
  • Rename tests to describe the behaviour and fix copy-paste names (linear-flow-skip-question, extending-data-definition)
  • Remove duplicated assertions in dependencies-between-questions
  • Split the long custom-component-types test into three tests
  • Enforce 100% coverage thresholds

Refactoring

  • Extract _getQuestionFromItem to remove a dead null check in _validate

Is there something controversial in your PR?

  • New protected method _getParentNavigationItemObject and a new parameter on _addNavigationItem. Subclasses that override _addNavigationItem must add the parameter.
  • Not fixed: getNavigation() still crashes when a child comes before its parent in navigationItems.

Checklist

  • Run unit tests to ensure all existing tests are still passing
  • Add new passing unit tests to cover the code introduced by your PR
  • Change documentation for the code introduced by your PR

🤖 Generated with Claude Code

devCrossNet and others added 2 commits October 8, 2026 17:45
getNavigation() threw a TypeError when a parent navigation item had no
question but its children had. The parent is now derived from its
children (hasValue, isValid). Parents without any question are skipped.

Also extract _getQuestionFromItem to remove a dead null check in _validate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- move misc.spec.ts to src/quaire.spec.ts and add edge case tests
- rename tests to describe the behaviour and fix copy-paste names
- remove duplicated assertions and split long custom component test
- enforce 100% coverage thresholds

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devCrossNet
devCrossNet merged commit fd5ed8b into main Oct 8, 2026
2 checks passed
@devCrossNet
devCrossNet deleted the test/full-coverage branch October 8, 2026 15:49
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.

1 participant