Skip to content

Commit 591c62d

Browse files
OUT-4029 | Fix authenticate test suite (p-retry ESM) and stale assertion
authenticate.test.ts failed to load: p-retry and is-network-error are pure ESM and next/jest only transforms packages listed in transpilePackages. - next.config.js: transpile p-retry / is-network-error (also adds ngrok dev origin) - authenticate.test.ts: update the public-route source fallback assertion from "public" to "platform" to match the intentional change in commit eb76729 (was hidden while the suite couldn't load) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 54d59ec commit 591c62d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

next.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ const { withSentryConfig } = require('@sentry/nextjs')
33
/** @type {import('next').NextConfig} */
44
const nextConfig = {
55
cacheMaxMemorySize: 0,
6+
// Pure-ESM deps; transpile so next/jest can load them from CJS.
7+
transpilePackages: ['p-retry', 'is-network-error'],
68
turbopack: {
79
rules: {
810
'*.svg': {
@@ -11,7 +13,7 @@ const nextConfig = {
1113
},
1214
},
1315
},
14-
allowedDevOrigins: ['*.ngrok-free.dev'],
16+
allowedDevOrigins: ['*.ngrok-free.dev', '*.ngrok-free.app'],
1517
async redirects() {
1618
return [
1719
{

src/app/api/tests/utils/authenticate.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ describe('authenticate util', () => {
8585
})
8686
})
8787

88-
it('uses "public" as source fallback for public routes', async () => {
88+
it('uses "platform" as source fallback for public routes', async () => {
8989
const req = new NextRequest(new Request(process.env.VERCEL_URL + '/api/tasks/public/?token=iu-token'))
9090
const user = await authenticate(req)
91-
expect(user.assemblyMetadata?.source).toBe('public')
91+
expect(user.assemblyMetadata?.source).toBe('platform')
9292
})
9393
})

0 commit comments

Comments
 (0)