rsnext/test/e2e/multi-zone/multi-zone.test.ts
JJ Kasper d49c700d0d
Fix shared entries/invalidators module scope (#46533)
This ensures we don't keep `entries` and `invalidator` in module scope
directly and nest it under a key specific to each compilation so
multiple `next` instances in the same process don't override one and
another.

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

Closes: https://github.com/vercel/next.js/pull/46432
Fixes: https://github.com/vercel/next.js/issues/45852
2023-02-28 10:17:28 -08:00

49 lines
1.2 KiB
TypeScript

import { createNextDescribe } from 'e2e-utils'
import path from 'path'
createNextDescribe(
'multi-zone',
{
files: path.join(__dirname, 'app'),
skipDeployment: true,
buildCommand: 'pnpm build',
startCommand: (global as any).isNextDev ? 'pnpm dev' : 'pnpm start',
packageJson: {
scripts: {
'post-build': 'echo done',
},
},
},
({ next }) => {
it.each([
{ pathname: '/first', content: ['hello from first app'] },
{ pathname: '/second', content: ['hello from second app'] },
{
pathname: '/first/blog/post-1',
content: ['hello from first app /blog/[slug]'],
},
{
pathname: '/second/blog/post-1',
content: ['hello from second app /blog/[slug]'],
},
{
pathname: '/second/another/post-1',
content: ['hello from second app /another/[slug]'],
},
])(
'should correctly respond for $pathname',
async ({ pathname, content }) => {
const res = await next.fetch(pathname, {
redirect: 'manual',
})
expect(res.status).toBe(200)
const html = await res.text()
for (const item of content) {
expect(html).toContain(item)
}
}
)
}
)