feat(plan): dönem notları — Markdown, yaz/önizle sekmeleri
- 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>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user