release: Евномия, новая версия, линейка юристов
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { expect, test } from 'claude-code/testing'
|
||||
|
||||
import type { Snapshot } from '../types'
|
||||
import { FACES } from './faces'
|
||||
import { headline, lineupSvg } from './register'
|
||||
|
||||
const st = (id: string, title: string, status: string, face: string, who: string) => ({ id, title, status, face, who })
|
||||
const run: Snapshot = {
|
||||
run: '/r', kase: 'client/case', status: 'running', label: 'идет', track: 'FAST', doc: 'иск',
|
||||
phase: 'karta', who: 'Александр Гольмстен', action: '', done: 1, total: 3, since: '10:34', elapsed: 125, mtime: 0,
|
||||
stations: [st('priem', 'Прием', 'ok', 'gruzenberg', 'Грузенберг'), st('karta', 'Карта', 'start', 'holmsten', 'Гольмстен'), st('sborka', 'Сборка', '', 'femida', 'Фемида')],
|
||||
}
|
||||
|
||||
test('идущий этап пульсирует, готовый отмечен, будущий серый', async () => {
|
||||
const svg = lineupSvg(run, { gruzenberg: ['#000000', [['#111111', 'M0 0.5h1']]], holmsten: ['#000000', [['#222222', 'M1 1.5h2']]], femida: ['#000000', [['#333333', 'M2 2.5h1']]] })
|
||||
expect(svg.match(/<animate /g)?.length).toBe(2)
|
||||
expect(svg).toContain('✓')
|
||||
expect(svg).toContain('<path stroke="#222222" d="M1 1.5h2"/>')
|
||||
expect(svg).not.toContain('<image')
|
||||
expect(svg).toContain('url(#gray)')
|
||||
expect(svg.length < 131072).toBe(true)
|
||||
})
|
||||
|
||||
test('строка называет этап, юриста и счет этапов', async () => {
|
||||
expect(headline(run)).toBe('Фемида · client/case · FAST · иск — Карта · Александр Гольмстен · этапов 1 из 3 · с 10:34')
|
||||
expect(headline({ ...run, status: 'stopped', label: 'остановлен' })).toContain('— остановлен · этапов 1 из 3 · шел 2 мин')
|
||||
})
|
||||
|
||||
test('восемь настоящих портретов укладываются в предел Svg', async () => {
|
||||
const all = FACES
|
||||
const big = Object.keys(all).sort((a, b) => JSON.stringify(all[b]).length - JSON.stringify(all[a]).length)
|
||||
const stations = Array.from({ length: 8 }, (_, i) => st(`p${i}`, 'Приложения', 'ok', big[i], 'Шершеневич'))
|
||||
expect(lineupSvg({ ...run, stations }, all).length < 131072).toBe(true)
|
||||
})
|
||||
Reference in New Issue
Block a user