Skip to content

Commit d0398bf

Browse files
committed
fix tests for new custom header
1 parent 8372a87 commit d0398bf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/node/test/middleware.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import { v4 as uuid } from "uuid"
1515
import { initBaseAuth } from "../src"
1616
import { RequiredOrgInfo } from "../src/auth"
1717

18-
const AUTH_URL = "https://auth.example.com"
18+
const BASE_API_URL = "https://propelauth-api.com"
19+
const AUTH_HOSTNAME = "auth.example.com"
20+
const AUTH_URL = "https://" + AUTH_HOSTNAME
1921
const ALGO = "RS256"
2022

2123
afterEach(() => {
@@ -372,9 +374,10 @@ async function setupTokenVerificationMetadataEndpoint() {
372374
const { publicKey, privateKey } = await generateRsaKeyPair()
373375
const apiKey = randomString()
374376

375-
const scope = nock(AUTH_URL)
377+
const scope = nock(BASE_API_URL)
376378
.get("/api/v1/token_verification_metadata")
377379
.matchHeader("authorization", `Bearer ${apiKey}`)
380+
.matchHeader("X-Propelauth-url", AUTH_HOSTNAME)
378381
.reply(
379382
200,
380383
JSON.stringify({
@@ -388,8 +391,9 @@ async function setupTokenVerificationMetadataEndpoint() {
388391
async function setupErrorTokenVerificationMetadataEndpoint(statusCode: number) {
389392
const apiKey = randomString()
390393

391-
const scope = nock(AUTH_URL)
394+
const scope = nock(BASE_API_URL)
392395
.get("/api/v1/token_verification_metadata")
396+
.matchHeader("X-Propelauth-url", AUTH_HOSTNAME)
393397
.matchHeader("authorization", `Bearer ${apiKey}`)
394398
.reply(statusCode)
395399

0 commit comments

Comments
 (0)