feat: 補齊規格缺漏(狀態列顯示思考程度、動漫層與主題色、萃取角色包可啟動)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
59fcf2b3eb
commit
e99e7b1536
@@ -2,6 +2,8 @@ import { expect, mock, test } from 'claude-code/testing'
|
||||
|
||||
import { HIDE_ORDER, bar, layout, remainColor, usedColor } from './statusline'
|
||||
import type { Segment } from './statusline'
|
||||
import { CHARACTERS, packToCharacter, personaSection, registerCharacters, themeColor } from './characters'
|
||||
import type { PackLike } from './characters'
|
||||
|
||||
const seg = (id: string, text: string): Segment => ({ id, parts: [{ text }] })
|
||||
|
||||
@@ -47,3 +49,27 @@ test('量表固定長度,剩餘越少越紅', () => {
|
||||
expect(remainColor(90, 60, 85)).toBe('green')
|
||||
expect(usedColor(70, 60, 85)).toBe('yellow')
|
||||
})
|
||||
|
||||
test('persona 含動漫層與口頭禪,主題色可用於狀態列', () => {
|
||||
const c = CHARACTERS[0]!
|
||||
const text = personaSection(c, c.axes)
|
||||
expect(text).toContain('動漫刻畫')
|
||||
expect(text).toContain('口頭禪')
|
||||
expect(themeColor(c)).toBe('red')
|
||||
})
|
||||
|
||||
test('角色包轉成可啟動角色:代號、年齡與原作戀人', () => {
|
||||
const pack: PackLike = {
|
||||
slug: 'rin', name: '凜', work: 'demo',
|
||||
persona: { selfRef: '我', address: '你', tone: '冷靜', catchphrase: '嗯', values: '誠實', taboos: '不說謊' },
|
||||
axes: CHARACTERS[0]!.axes,
|
||||
anime: { moe: 'm', speech: 's', emotions: 'e', kaomoji: 'k', themeColor: 'blue' },
|
||||
timeline: [{ chapter: '第2章', age: 19, relationships: [{ with: '蓮', kind: 'romantic' }] }],
|
||||
}
|
||||
const c = packToCharacter(pack, '示範')
|
||||
expect(c.slug).toBe('demo-rin')
|
||||
expect(c.timeline).toEqual([{ chapter: 2, age: 19, romance: '蓮' }])
|
||||
expect(themeColor(c)).toBe('cyan')
|
||||
registerCharacters([c, c])
|
||||
expect(CHARACTERS.filter(x => x.slug === 'demo-rin').length).toBe(1)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user