Files
claude-code/packages/pokemon/src/__tests__/names.test.ts
claude-code-best fa8e45e933 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>
2026-04-22 00:45:57 +08:00

45 lines
1.2 KiB
TypeScript

import { describe, test, expect } from 'bun:test'
import { SPECIES_NAMES, SPECIES_I18N, SPECIES_PERSONALITY } from '../data/names'
import { ALL_SPECIES_IDS } from '../types'
describe('SPECIES_NAMES', () => {
test('has name for every species', () => {
for (const id of ALL_SPECIES_IDS) {
expect(SPECIES_NAMES[id]).toBeTruthy()
}
})
test('Charmander name is correct', () => {
expect(SPECIES_NAMES.charmander).toBe('Charmander')
})
})
describe('SPECIES_I18N', () => {
test('has i18n for every species', () => {
for (const id of ALL_SPECIES_IDS) {
expect(SPECIES_I18N[id]).toBeTruthy()
expect(SPECIES_I18N[id]!.en).toBeTruthy()
}
})
test('has Chinese translations', () => {
expect(SPECIES_I18N.pikachu!.zh).toBe('皮卡丘')
expect(SPECIES_I18N.squirtle!.zh).toBe('杰尼龟')
})
})
describe('SPECIES_PERSONALITY', () => {
test('has personality for every species', () => {
for (const id of ALL_SPECIES_IDS) {
expect(SPECIES_PERSONALITY[id]).toBeTruthy()
}
})
test('personality is non-empty string', () => {
for (const id of ALL_SPECIES_IDS) {
expect(typeof SPECIES_PERSONALITY[id]).toBe('string')
expect(SPECIES_PERSONALITY[id]!.length).toBeGreaterThan(0)
}
})
})