first commit

This commit is contained in:
wsq
2026-05-13 21:58:19 +08:00
commit 0167c66cb7
1475 changed files with 233414 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
import { describe, expect, it } from 'vitest'
import { formatDefaultProjectTimestamp } from '@/lib/projects/default-name'
describe('default project name timestamp', () => {
it('formats month-day and hour-minute without year', () => {
expect(formatDefaultProjectTimestamp(new Date('2026-03-29T18:56:42+08:00'))).toBe('03-29 18:56')
})
})
+28
View File
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest'
import {
normalizeProjectDraft,
validateProjectDraft,
} from '@/lib/projects/validation'
describe('project validation', () => {
it('normalizes blank descriptions to null', () => {
expect(normalizeProjectDraft({
name: ' 项目 A ',
description: ' ',
})).toEqual({
name: '项目 A',
description: null,
})
})
it('rejects descriptions longer than the shared max limit', () => {
expect(validateProjectDraft({
name: '项目 A',
description: 'a'.repeat(501),
})).toEqual({
code: 'PROJECT_DESCRIPTION_TOO_LONG',
field: 'description',
limit: 500,
})
})
})