Skip to content

Add test suite for background scripts#10

Merged
dantraynor merged 3 commits into
mainfrom
dantraynor/add-test-suite
Mar 13, 2026
Merged

Add test suite for background scripts#10
dantraynor merged 3 commits into
mainfrom
dantraynor/add-test-suite

Conversation

@dantraynor

Copy link
Copy Markdown
Owner

Adds Vitest tests for ProxyManager and StateStore covering proxy routing, PAC script generation, CIDR parsing, and state management.

Copilot AI review requested due to automatic review settings March 13, 2026 03:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Vitest-based test harness for the extension background layer, focusing on validating proxy/PAC behavior and state-store updates under a mocked Chrome runtime.

Changes:

  • Introduces Vitest configuration and a minimal chrome global mock for background-script tests.
  • Adds unit tests for StateStore state merging, subscriptions, and StatusUpdate normalization behavior.
  • Adds comprehensive tests for ProxyManager apply/clear behavior, PAC script generation, and CIDR/subnet routing handling.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
extension/vitest.config.ts Configures Vitest to run src/**/*.test.ts with a shared setup file.
extension/src/test/chrome-mock.ts Provides a minimal globalThis.chrome mock for background-script tests.
extension/src/background/state-store.test.ts Tests StateStore initial state, updates, subscriptions, and applyStatusUpdate normalization.
extension/src/background/proxy-manager.test.ts Tests proxy enable/disable flows plus PAC generation and routing semantics (incl. CIDR/subnets).
extension/package.json Adds vitest and test scripts to the extension package.
extension/package-lock.json Locks Vitest/Vite dependency tree for deterministic installs.
Files not reviewed (1)
  • extension/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extension/src/background/proxy-manager.test.ts
Comment thread extension/package.json Outdated
dantraynor and others added 2 commits March 12, 2026 23:49
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@dantraynor dantraynor merged commit abe7423 into main Mar 13, 2026
@dantraynor dantraynor deleted the dantraynor/add-test-suite branch March 13, 2026 03:51
dantraynor added a commit that referenced this pull request Mar 14, 2026
* Add test suite for background scripts

* Reduce strictness for matching

* Node compatibility
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