Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
test/e2e/app-dir/app-simple-routes/app-simple-routes.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { createNextDescribe } from 'e2e-utils' | ||
import { check } from 'next-test-utils' | ||
import { Readable } from 'stream' | ||
|
||
const bathPath = process.env.BASE_PATH ?? '' | ||
|
||
createNextDescribe( | ||
'app-simple-routes', | ||
{ | ||
files: __dirname, | ||
}, | ||
({ next, isNextDeploy, isNextDev, isNextStart }) => { | ||
describe('works with simple routes', () => { | ||
it('renders a node route', async () => { | ||
expect( | ||
JSON.parse(await next.render(bathPath + '/api/node.json')) | ||
).toEqual({ | ||
pathname: '/api/node.json', | ||
}) | ||
}) | ||
it('renders a edge route', async () => { | ||
expect( | ||
JSON.parse(await next.render(bathPath + '/api/edge.json')) | ||
).toEqual({ | ||
pathname: '/api/edge.json', | ||
}) | ||
}) | ||
}) | ||
} | ||
) |
9 changes: 9 additions & 0 deletions
9
test/e2e/app-dir/app-simple-routes/app/api/edge.json/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { NextRequest, NextResponse } from 'next/server' | ||
|
||
export const GET = (req: NextRequest) => { | ||
return NextResponse.json({ | ||
pathname: req.nextUrl.pathname, | ||
}) | ||
} | ||
|
||
export const runtime = 'edge' |
7 changes: 7 additions & 0 deletions
7
test/e2e/app-dir/app-simple-routes/app/api/node.json/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { NextRequest, NextResponse } from 'next/server' | ||
|
||
export const GET = (req: NextRequest) => { | ||
return NextResponse.json({ | ||
pathname: req.nextUrl.pathname, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
const config = { | ||
typescript: { | ||
ignoreBuildErrors: true, | ||
}, | ||
} | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters