mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 08:15:53 +00:00
test: 新增数据层测试 + 引擎修复
- 新增 pkmn.test.ts: stat 映射测试 - 新增 species.test.ts: 物种数据测试 - 新增 xpTable.test.ts: XP 公式测试 - 新增 evMapping.test.ts: EV 映射测试 - 新增 names.test.ts: 多语言名称测试 - 新增 fallback.test.ts: 精灵 fallback 测试 - 修复 engine.ts 类型 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
packages/pokemon/src/__tests__/fallback.test.ts
Normal file
28
packages/pokemon/src/__tests__/fallback.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { describe, test, expect } from 'bun:test'
|
||||
import { getFallbackSprite } from '../sprites/fallback'
|
||||
import { ALL_SPECIES_IDS } from '../types'
|
||||
|
||||
describe('getFallbackSprite', () => {
|
||||
test('returns 5 lines for every species', () => {
|
||||
for (const id of ALL_SPECIES_IDS) {
|
||||
const sprite = getFallbackSprite(id)
|
||||
expect(sprite.length).toBe(5)
|
||||
}
|
||||
})
|
||||
|
||||
test('returns pikachu fallback for unknown species', () => {
|
||||
const sprite = getFallbackSprite('unknown' as any)
|
||||
expect(sprite).toEqual(getFallbackSprite('pikachu'))
|
||||
})
|
||||
|
||||
test('each line has consistent width', () => {
|
||||
for (const id of ALL_SPECIES_IDS) {
|
||||
const sprite = getFallbackSprite(id)
|
||||
const widths = sprite.map(line => line.length)
|
||||
// All lines should be roughly the same width
|
||||
const maxWidth = Math.max(...widths)
|
||||
const minWidth = Math.min(...widths)
|
||||
expect(maxWidth - minWidth).toBeLessThanOrEqual(2)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user