Tests, UX improvements.
This commit is contained in:
parent
4e6f5d36b8
commit
0ae18f495e
63 changed files with 1384 additions and 2330 deletions
|
|
@ -5,7 +5,6 @@ import {
|
|||
memberCreateSchema,
|
||||
memberProfileUpdateSchema,
|
||||
eventRegistrationSchema,
|
||||
updateCreateSchema,
|
||||
paymentVerifySchema,
|
||||
adminEventCreateSchema
|
||||
} from '../../../server/utils/schemas.js'
|
||||
|
|
@ -120,55 +119,6 @@ describe('eventRegistrationSchema', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('updateCreateSchema', () => {
|
||||
it('accepts valid content', () => {
|
||||
const result = updateCreateSchema.safeParse({ content: 'Hello world' })
|
||||
expect(result.success).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects empty content', () => {
|
||||
const result = updateCreateSchema.safeParse({ content: '' })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects content exceeding 50000 chars', () => {
|
||||
const result = updateCreateSchema.safeParse({ content: 'a'.repeat(50001) })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('accepts content at exactly 50000 chars', () => {
|
||||
const result = updateCreateSchema.safeParse({ content: 'a'.repeat(50000) })
|
||||
expect(result.success).toBe(true)
|
||||
})
|
||||
|
||||
it('validates images are URLs', () => {
|
||||
const result = updateCreateSchema.safeParse({
|
||||
content: 'test',
|
||||
images: ['not-a-url']
|
||||
})
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('accepts valid images array', () => {
|
||||
const result = updateCreateSchema.safeParse({
|
||||
content: 'test',
|
||||
images: ['https://example.com/img.png']
|
||||
})
|
||||
expect(result.success).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects more than 20 images', () => {
|
||||
const images = Array.from({ length: 21 }, (_, i) => `https://example.com/img${i}.png`)
|
||||
const result = updateCreateSchema.safeParse({ content: 'test', images })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('validates privacy enum', () => {
|
||||
const result = updateCreateSchema.safeParse({ content: 'test', privacy: 'invalid' })
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('paymentVerifySchema', () => {
|
||||
it('accepts valid card token and customer ID', () => {
|
||||
const result = paymentVerifySchema.safeParse({ cardToken: 'tok_123', customerId: 'cust_456' })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue