eca0bb27a0
- NotesSection: ekle/düzenle/sil (onaylı), yazar ve tarih, kapalı dönemde salt okunur - Markdown gösterimi (react-markdown + remark-gfm): ham HTML yok, güvenli bağlantılar - Çakışma (409) mesajı formda; Plan sayfasına bağlandı - Dağıtım çubuğu boş dönemde "tamamı dağıtıldı" demiyor - Faz 4 tamamlandı Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
836 B
TypeScript
26 lines
836 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { t } from '@/lib/strings'
|
|
import { noteSchema } from './schema'
|
|
|
|
const err = (title: string, body_md = '') => {
|
|
const r = noteSchema.safeParse({ title, body_md })
|
|
return r.success ? null : r.error.issues[0].message
|
|
}
|
|
|
|
describe('noteSchema', () => {
|
|
it('accepts a note with an empty body', () => {
|
|
expect(err('Hedefler')).toBeNull()
|
|
})
|
|
|
|
it('rejects empty and too long titles', () => {
|
|
expect(err(' ')).toBe(t.notes.titleRequired)
|
|
expect(err('x'.repeat(121))).toBe(t.notes.titleTooLong)
|
|
})
|
|
|
|
it('counts characters like the backend (emoji = 1)', () => {
|
|
expect(err('🎯'.repeat(120))).toBeNull() // UTF-16'da 240 birim
|
|
expect(err('Not', '🎯'.repeat(20_000))).toBeNull()
|
|
expect(err('Not', 'a'.repeat(20_001))).toBe(t.notes.bodyTooLong)
|
|
})
|
|
})
|