From b8a5ab44fc81a2f8340306182360b29d398bdb4d Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Wed, 5 Aug 2026 14:58:31 -0500 Subject: [PATCH 1/2] pull_request to run tests with forks --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f68e3c30..56cd2e5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,8 @@ name: Test -on: push +on: + push: + pull_request: jobs: run-tests: From 7368ac70bb02a2e1ecf8abc40774ceaa4827279e Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Wed, 5 Aug 2026 15:00:03 -0500 Subject: [PATCH 2/2] keep rules tests local, not external calls --- .../fixtures/rules-async-only/async-rule.js | 4 ++-- .../async-rule.js | 4 ++-- packages/auth0/test/rules.test.ts | 22 +++++++++++++++---- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/auth0/test/fixtures/rules-async-only/async-rule.js b/packages/auth0/test/fixtures/rules-async-only/async-rule.js index b8c7476e..e983185f 100644 --- a/packages/auth0/test/fixtures/rules-async-only/async-rule.js +++ b/packages/auth0/test/fixtures/rules-async-only/async-rule.js @@ -17,7 +17,7 @@ async function asyncRule(user, context, callback) { // these is a contrived rule, but entirely possible // that someone would run a fetch and attach output // to the user as part of the token - let checkURLOne = "https://frontside.com"; + let checkURLOne = `${__simulator.context.idToken.iss}frontside`; user.checkURLOne = checkURLOne; let checkOne = await fetcher(checkURLOne); user.checkURLOneStatus = checkOne.checkURLStatus; @@ -25,7 +25,7 @@ async function asyncRule(user, context, callback) { // this is a sub-site with various redirects to it should // take some time to revolve - let checkURLTwo = "https://frontside.com/effection"; + let checkURLTwo = `${__simulator.context.idToken.iss}effection`; user.checkURLTwo = checkURLTwo; let checkTwo = await fetcher(checkURLTwo); user.checkURLTwoStatus = checkTwo.checkURLStatus; diff --git a/packages/auth0/test/fixtures/rules-sync-wrapper-with-async/async-rule.js b/packages/auth0/test/fixtures/rules-sync-wrapper-with-async/async-rule.js index 9d858be9..f6cb0382 100644 --- a/packages/auth0/test/fixtures/rules-sync-wrapper-with-async/async-rule.js +++ b/packages/auth0/test/fixtures/rules-sync-wrapper-with-async/async-rule.js @@ -7,12 +7,12 @@ function syncWrapper(user, context, callback) { // these is a contrived rule, but entirely possible // that someone would run a fetch and attach output // to the user as part of the token - let checkURLOne = "https://frontside.com"; + let checkURLOne = `${__simulator.context.idToken.iss}frontside`; user.checkURLOne = checkURLOne; // this is a sub-site with various redirects to it should // take some time to revolve - let checkURLTwo = "https://frontside.com/effection"; + let checkURLTwo = `${__simulator.context.idToken.iss}effection`; user.checkURLTwo = checkURLTwo; let fetcher = async (url) => { diff --git a/packages/auth0/test/rules.test.ts b/packages/auth0/test/rules.test.ts index 6d91a8f0..ce625f58 100644 --- a/packages/auth0/test/rules.test.ts +++ b/packages/auth0/test/rules.test.ts @@ -43,6 +43,20 @@ async function createSimulation(rulesDirectory: Fixtures, initialPerson?: Partia users: [simulationPerson], }, options: { rulesDirectory }, + extend: { + extendRouter(router) { + router.get("/frontside", (_req, res) => { + res.send( + "frontside", + ); + }); + router.get("/effection", (_req, res) => { + res.send( + "effection", + ); + }); + }, + }, }); let server = await app.listen(basePort); @@ -233,10 +247,10 @@ describe("rules", () => { const idToken = decodeJwt(token.id_token); expect(idToken.name).toBe(person.name); - expect(idToken?.checkURLOne).toBe("https://frontside.com"); + expect(idToken?.checkURLOne).toBe(`${auth0Url}/frontside`); expect(idToken?.checkURLOneStatus).toBe(200); expect(idToken?.checkURLOneText).toBe("frontside"); - expect(idToken?.checkURLTwo).toBe("https://frontside.com/effection"); + expect(idToken?.checkURLTwo).toBe(`${auth0Url}/effection`); expect(idToken?.checkURLTwoStatus).toBe(200); expect(idToken?.checkURLTwoText).toBe("effection"); await server.ensureClose(); @@ -265,11 +279,11 @@ describe("rules", () => { const idToken = decodeJwt(token.id_token); expect(idToken.name).toBe(person.name); - expect(idToken?.checkURLOne).toBe("https://frontside.com"); + expect(idToken?.checkURLOne).toBe(`${auth0Url}/frontside`); expect(idToken?.checkURLOneStatus).toBe(200); expect(idToken?.checkURLOneText).toBe("frontside"); - expect(idToken?.checkURLTwo).toBe("https://frontside.com/effection"); + expect(idToken?.checkURLTwo).toBe(`${auth0Url}/effection`); expect(idToken?.checkURLTwoStatus).toBe(200); expect(idToken?.checkURLTwoText).toBe("effection"); await server.ensureClose();