- 新增 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>
29 lines
904 B
TypeScript
29 lines
904 B
TypeScript
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)
|
|
}
|
|
})
|
|
})
|