mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #36219 from overleaf/jpa-zod-web-platform
[web] platform: adopt strict zod schema and extend test coverage GitOrigin-RevId: e3a0b7b4c52ac116f28be0d284284e3bd3994cda
This commit is contained in:
@@ -842,40 +842,6 @@ describe('zodHelpers', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('streamedBody', () => {
|
||||
it('parses undefined (no body parser mounted) to undefined', () => {
|
||||
const parsed = zz.streamedBody().safeParse(undefined)
|
||||
expect(parsed.success).toBe(true)
|
||||
expect(parsed.data).toBe(undefined)
|
||||
})
|
||||
|
||||
it('parses the empty object left by a skipping body parser to undefined', () => {
|
||||
const parsed = zz.streamedBody().safeParse({})
|
||||
expect(parsed.success).toBe(true)
|
||||
expect(parsed.data).toBe(undefined)
|
||||
})
|
||||
|
||||
it('fails to parse a parsed JSON body', () => {
|
||||
const parsed = zz.streamedBody().safeParse({ some: 'payload' })
|
||||
expect(parsed.success).toBe(false)
|
||||
expect(parsed.error?.issues).toMatchObject([
|
||||
expect.objectContaining({
|
||||
message: 'unexpected parsed request body on streamed endpoint',
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
it('fails to parse a raw buffer body', () => {
|
||||
const parsed = zz.streamedBody().safeParse(Buffer.alloc(0))
|
||||
expect(parsed.success).toBe(false)
|
||||
})
|
||||
|
||||
it('fails to parse a string body', () => {
|
||||
const parsed = zz.streamedBody().safeParse('text body')
|
||||
expect(parsed.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('uploadedFile', () => {
|
||||
const validFile = {
|
||||
fieldname: 'qqfile',
|
||||
|
||||
Reference in New Issue
Block a user