Skip to content

Commit c82a921

Browse files
committed
test: Update existing e2e tests and considering the default use case for multi-zones
1 parent c21d107 commit c82a921

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

test/e2e/multi-zone/app/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const http = require('http')
77
const requestHandlers = new Map()
88
const dev = process.env.NODE_ENV !== 'production'
99

10-
for (const appName of ['first', 'second']) {
10+
for (const appName of ['host', 'guest']) {
1111
const appDir = path.join(__dirname, 'apps', appName)
1212
const nextApp = next({
1313
dir: appDir,
@@ -20,7 +20,7 @@ const http = require('http')
2020
}
2121

2222
const server = http.createServer(async (req, res) => {
23-
const appName = req.url?.split('/')[1].split('?')[0]
23+
const appName = req.url.startsWith('/guest') ? 'guest' : 'host'
2424
const handler = requestHandlers.get(appName)
2525

2626
if (!handler) {

test/e2e/multi-zone/multi-zone.test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ createNextDescribe(
1717
},
1818
({ next, isNextDev }) => {
1919
it.each([
20-
{ pathname: '/first', content: ['hello from first app'] },
21-
{ pathname: '/second', content: ['hello from second app'] },
20+
{ pathname: '/', content: ['hello from host app'] },
21+
{ pathname: '/guest', content: ['hello from guest app'] },
2222
{
23-
pathname: '/first/blog/post-1',
24-
content: ['hello from first app /blog/[slug]'],
23+
pathname: '/blog/post-1',
24+
content: ['hello from host app /blog/[slug]'],
2525
},
2626
{
27-
pathname: '/second/blog/post-1',
28-
content: ['hello from second app /blog/[slug]'],
27+
pathname: '/guest/blog/post-1',
28+
content: ['hello from guest app /blog/[slug]'],
2929
},
3030
{
31-
pathname: '/second/another/post-1',
32-
content: ['hello from second app /another/[slug]'],
31+
pathname: '/guest/another/post-1',
32+
content: ['hello from guest app /another/[slug]'],
3333
},
3434
])(
3535
'should correctly respond for $pathname',
@@ -49,7 +49,8 @@ createNextDescribe(
4949

5050
if (isNextDev) {
5151
async function runHMRTest(app: string) {
52-
const browser = await next.browser(`/${app}`)
52+
const isHostApp = app === 'host'
53+
const browser = await next.browser(isHostApp ? '/' : app)
5354
expect(await browser.elementByCss('body').text()).toContain(
5455
`hello from ${app} app`
5556
)
@@ -82,8 +83,8 @@ createNextDescribe(
8283
}
8384

8485
it('should support HMR in both apps', async () => {
85-
await runHMRTest('first')
86-
await runHMRTest('second')
86+
await runHMRTest('host')
87+
await runHMRTest('guest')
8788
})
8889
}
8990
}

0 commit comments

Comments
 (0)