feat: refine UI, improve UX, optimize the analysis pipeline, and add character standing positions
This commit is contained in:
@@ -73,4 +73,38 @@ describe('api specific - project create default audio model', () => {
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
||||
it('returns an explicit validation error when description exceeds the max length', async () => {
|
||||
const mod = await import('@/app/api/projects/route')
|
||||
const req = buildMockRequest({
|
||||
path: '/api/projects',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'accept-language': 'zh-CN',
|
||||
},
|
||||
body: {
|
||||
name: 'Test Project',
|
||||
description: 'a'.repeat(501),
|
||||
},
|
||||
})
|
||||
|
||||
const res = await mod.POST(req, routeContext)
|
||||
const body = await res.json() as {
|
||||
error?: {
|
||||
code?: string
|
||||
message?: string
|
||||
details?: {
|
||||
field?: string
|
||||
limit?: number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
expect(body.error?.code).toBe('INVALID_PARAMS')
|
||||
expect(body.error?.message).toBe('项目描述不能超过 500 个字符。')
|
||||
expect(body.error?.details?.field).toBe('description')
|
||||
expect(body.error?.details?.limit).toBe(500)
|
||||
expect(prismaMock.project.create).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user