Skip to content

test: Add unit tests for injected browser scripts#43

Merged
freema merged 2 commits intomainfrom
feat/injected-script-unit-tests
Feb 27, 2026
Merged

test: Add unit tests for injected browser scripts#43
freema merged 2 commits intomainfrom
feat/injected-script-unit-tests

Conversation

@freema
Copy link
Owner

@freema freema commented Feb 27, 2026

What's Changed

Add comprehensive unit tests for injected browser scripts (elementCollector, treeWalker, snapshot.injected) that previously had zero test coverage.

New test files

  • tests/firefox/snapshot/injected/elementCollector.test.ts — 27 tests
  • tests/firefox/snapshot/injected/treeWalker.test.ts — 13 tests
  • tests/firefox/snapshot/injected/snapshot.injected.test.ts — 8 tests

Updated

  • tests/tools/snapshot.test.ts — 2 new tests for includeAll and selector schema properties
  • package.json — bump version to 0.7.4, add jsdom + @types/jsdom devDependencies

Closes

Full Changelog: 0.7.3...feat/injected-script-unit-tests

Add comprehensive jsdom-based unit tests for snapshot injected scripts
that previously had zero test coverage:
- elementCollector.test.ts (27 tests): isVisible, isRelevant, isFocusable, isInteractive
- treeWalker.test.ts (13 tests): basic walk, bubble-up pattern, includeAll, limits, iframes
- snapshot.injected.test.ts (8 tests): createSnapshot, selector, includeAll, window global
- snapshot.test.ts: add schema tests for includeAll and selector properties

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@freema freema merged commit 7175292 into main Feb 27, 2026
1 check 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.

1 participant