10f2268f4e
This PR adds Zod to the precompiled libraries, and use it to create schemas for the router state tree for validation. In other planned features/changes, Zod will also be used to do run-time data validation. Fixes NEXT-135.
28 lines
655 B
TypeScript
28 lines
655 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
|
|
createNextDescribe(
|
|
'app dir validation',
|
|
{
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
},
|
|
({ next }) => {
|
|
it('should error when passing invalid router state tree', async () => {
|
|
const res = await next.fetch('/', {
|
|
headers: {
|
|
RSC: '1',
|
|
'Next-Router-State-Tree': JSON.stringify(['', '']),
|
|
},
|
|
})
|
|
expect(res.status).toBe(500)
|
|
|
|
const res2 = await next.fetch('/', {
|
|
headers: {
|
|
RSC: '1',
|
|
'Next-Router-State-Tree': JSON.stringify(['', {}]),
|
|
},
|
|
})
|
|
expect(res2.status).toBe(200)
|
|
})
|
|
}
|
|
)
|