feat: refine UI, improve UX, optimize the analysis pipeline, and add character standing positions
This commit is contained in:
8
tests/unit/projects/default-name.test.ts
Normal file
8
tests/unit/projects/default-name.test.ts
Normal 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
tests/unit/projects/validation.test.ts
Normal file
28
tests/unit/projects/validation.test.ts
Normal 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,
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user