ConusAI vendor v0.1.0-dev.20261013+85463d22
This commit is contained in:
parent
c3c6526952
commit
0da8a2a81b
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { MAX_UPLOAD_BYTES } from '@/entities/file'
|
||||
import nextConfig from '../next.config'
|
||||
|
||||
// The upload form posts to a server action, whose body Next caps at 1 MB unless
|
||||
// configured (next.config `experimental.serverActions.bodySizeLimit`). The cap must
|
||||
// admit the largest attachment the app accepts, plus multipart overhead.
|
||||
function parseLimit(limit: string | number | undefined): number | undefined {
|
||||
if (typeof limit === 'number') return limit
|
||||
const match = /^(\d+)mb$/.exec(limit ?? '')
|
||||
return match ? Number(match[1]) * 1024 * 1024 : undefined
|
||||
}
|
||||
|
||||
describe('next.config server action body limit', () => {
|
||||
it('admits the largest attachment the app accepts', () => {
|
||||
const limit = parseLimit(nextConfig.experimental?.serverActions?.bodySizeLimit)
|
||||
expect(limit).toBeGreaterThanOrEqual(MAX_UPLOAD_BYTES)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user