Skip to content

test: consolidate utm helper tests into one suite - #218

Merged
sadjow merged 2 commits into
mainfrom
test/consolidate-utm-helper-tests
Oct 14, 2026
Merged

sadjow merged 2 commits into
mainfrom
test/consolidate-utm-helper-tests

Conversation

@sadjow

@sadjow sadjow commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

The tests for src/runtime/utm.ts were split between test/unit.test.ts and test/unit/utm.test.ts. They now live in test/utm.test.ts, next to history.test.ts and storage.test.ts, so the history, storage, and utm helpers each have one test file named after them.

The suite keeps all 22 cases. The 13 getGCLID cases become one table, and the shared fixture is a typed DataObject instead of a JSON string. readLocalData now receives its storage through the existing parameter rather than a mock assigned to global.localStorage, so the suite no longer depends on, or replaces, a global that newer Node versions define.

This prepares the file for the upcoming change that adds more campaign parameters, which extends these helpers.

Validation: pnpm lint --max-warnings 0, pnpm test:types, Prettier on the new file, and pnpm test (81 tests) pass.

@sadjow

sadjow commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

Review notes before merging:

  • All 22 cases from test/unit.test.ts and test/unit/utm.test.ts are still here with the same inputs and expectations, and the two urlHasUtmParams checks got stricter (toBe(true) and toBe(false) instead of truthy and falsy). Nothing under src/ changed.
  • The description said every runtime module has a test file named after it, which isn't true for composables.ts or plugin.ts. I corrected it to name the helpers it covers.
  • The entry fixture and the history ref are now shared across tests. Nothing mutates them, so it's safe today, but new tests here should keep deriving objects with spreads instead of changing these in place.

@sadjow
sadjow enabled auto-merge (squash) October 14, 2026 01:07
@sadjow
sadjow merged commit 09954db into main Oct 14, 2026
7 checks passed
@sadjow
sadjow deleted the test/consolidate-utm-helper-tests branch October 14, 2026 01:14
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