Skip to content

test: use a syntactically valid domain in middleware test#54

Merged
frederikprijck merged 1 commit into
mainfrom
fix/test-valid-domain
Jun 23, 2026
Merged

test: use a syntactically valid domain in middleware test#54
frederikprijck merged 1 commit into
mainfrom
fix/test-valid-domain

Conversation

@frederikprijck

@frederikprijck frederikprijck commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

The auth.server middleware test passed the literal placeholder '<domain>' as the Auth0 domain. Since @auth0/auth0-server-js 1.6.0, the ServerClient constructor validates the domain by running it through new URL() (added with the resolver/multi-domain support). new URL('https://<domain>') throws Invalid URL because < and > are illegal in a hostname, so getUser() throws and the test fails.

Change

domain: '<domain>'domain: 'example.auth0.local' in middleware.test.ts — a syntactically valid host that never resolves (no network calls), so the test is robust across SDK versions.

Verification

  • middleware.test.ts passes against server-js 1.6.1 (the version a fresh install resolves)
  • Full unit suite (44 tests) + lint green

Summary by CodeRabbit

  • Tests
    • Updated test configuration to use a concrete local domain value instead of a placeholder.

The middleware test passed '<domain>' as the Auth0 domain. Since
@auth0/auth0-server-js 1.6.0, the ServerClient constructor validates the
domain via new URL(), which throws 'Invalid URL' on the '<' / '>' characters
— so getUser() failed and the test broke on any install resolving >=1.6.0.

The repo intentionally ships no package-lock (#42), so fresh installs now
resolve the newer SDK and surface this. Use 'example.auth0.local', a
syntactically valid host that never resolves, so the test is robust across
SDK versions without making network calls.
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

In the middleware test file, the runtimeConfig.auth0.domain value is changed from the generic placeholder string '<domain>' to the concrete value 'example.auth0.local'.

Changes

Middleware Test Domain Fix

Layer / File(s) Summary
Replace placeholder domain
packages/auth0-nuxt/test/middleware.test.ts
runtimeConfig.auth0.domain is updated from '<domain>' to 'example.auth0.local' in the test setup.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~1 minute

Poem

A rabbit hopped by, tweaked a test with care,
No more <domain> floating in the air,
example.auth0.local now stands firm and true,
One small line changed, the test shines brand new!
🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main change: replacing an invalid placeholder domain with a syntactically valid one in the middleware test.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-valid-domain

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@frederikprijck frederikprijck merged commit 45c1f27 into main Jun 23, 2026
13 checks passed
@frederikprijck frederikprijck deleted the fix/test-valid-domain branch June 23, 2026 19:10
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