import { describe, expect, it } from 'vitest' import { ITEMS } from '../src/renderer/game/data/items' import { TECHNIQUES } from '../src/renderer/game/data/techniques' import { BUILDINGS } from '../src/renderer/game/data/buildings' import { POSTS } from '../src/renderer/game/data/posts' import { TRAITS } from '../src/renderer/game/data/traits' import { ASPIRATIONS } from '../src/renderer/game/data/aspirations' import { FORMATIONS } from '../src/renderer/game/data/formations' import { SEASON } from '../src/renderer/game/data/season' import { ROOT_GRADES } from '../src/renderer/game/data/elements' import { MAJORS } from '../src/renderer/game/data/realms' describe('矩阵:物品表全量', () => { it.each(Object.values(ITEMS))('%s:三件套字段合法', (item) => { expect(item.id.length).toBeGreaterThan(0) expect(['resource', 'material', 'pill', 'talisman', 'brew', 'artifact']).toContain(item.kind) expect(item.basePrice).toBeGreaterThan(0) expect(item.icon.length).toBeGreaterThan(0) expect(item.name.length).toBeGreaterThan(0) }) it.each(Object.values(ITEMS))('%s:描述非空', (item) => { expect(item.desc.length).toBeGreaterThan(2) }) }) describe('矩阵:功法表全量', () => { it.each(TECHNIQUES)('%s:五元组合法', (t) => { expect(t.grade).toBeGreaterThanOrEqual(1) expect(t.grade).toBeLessThanOrEqual(4) expect(t.expBonus).toBeGreaterThan(0) expect(t.powerBonus).toBeGreaterThan(0) expect(['木', '金', '水', '火', '土', '雷']).toContain(t.element) expect(t.path.length).toBeGreaterThan(0) }) }) describe('矩阵:建筑表全量', () => { it.each(Object.values(BUILDINGS))('%s:配置合法', (b) => { expect(['produce', 'function']).toContain(b.kind) expect(b.maxLevel).toBeGreaterThanOrEqual(1) expect(b.maxLevel).toBeLessThanOrEqual(6) expect(b.desc.length).toBeGreaterThan(0) expect(b.icon.length).toBeGreaterThan(0) const cost1 = b.upgradeCost(1) expect(cost1.stones).toBeGreaterThan(0) expect(cost1.lingkuang).toBeGreaterThanOrEqual(0) }) }) describe('矩阵:职事表全量', () => { it.each(Object.values(POSTS))('%s:效果与上限合法', (p) => { expect(p.max).toBeGreaterThan(0) expect(p.desc.length).toBeGreaterThan(0) expect(p.effect).toBeTruthy() }) }) describe('矩阵:性格表全量', () => { it.each(Object.values(TRAITS))('%s:特质元组合法', (t) => { expect(t.name.length).toBeGreaterThan(0) expect(t.desc.length).toBeGreaterThan(2) void t }) }) describe('矩阵:志向表全量', () => { it.each(Object.values(ASPIRATIONS))('%s:效果形状合法', (a) => { expect(a.name.length).toBeGreaterThan(0) expect(a.effect).toBeTruthy() }) }) describe('矩阵:阵型表全量', () => { it.each(Object.entries(FORMATIONS).map(([id, f]) => ({ id, f })))('%s:攻防系数正', ({ id, f }) => { expect(f.atk).toBeGreaterThan(0.5) expect(f.def).toBeGreaterThan(0.5) expect(f.retreatWound).toBeGreaterThanOrEqual(0) expect(f.name.length).toBeGreaterThan(0) }) }) describe('矩阵:灵根表全量', () => { it.each(Object.entries(ROOT_GRADES).map(([id, g]) => ({ id, g })))('%s:expBonus 正', ({ id, g }) => { expect(g.expBonus).toBeGreaterThan(0) expect(id.length).toBeGreaterThan(0) }) }) describe('矩阵:境界表全量', () => { it.each(Object.entries(MAJORS).map(([id, m]) => ({ id, m })))('%s:寿命与层数合法', ({ id, m }) => { expect(m.lifespan).toBeGreaterThan(0) expect(m.minorLayers).toBeGreaterThanOrEqual(0) expect(typeof m.name).toBe('string') expect(id.length).toBeGreaterThan(0) }) }) describe('矩阵:季节表全量', () => { it.each(Object.entries(SEASON).map(([id, s]) => ({ id, s })))('%s:四乘子区间合法', ({ id, s }) => { expect(['spring', 'summer', 'autumn', 'winter']).toContain(id) expect(s.field).toBeGreaterThanOrEqual(-0.3) expect(s.field).toBeLessThanOrEqual(0.3) expect(s.cult).toBeGreaterThanOrEqual(-0.3) expect(s.cult).toBeLessThanOrEqual(0.3) expect(s.market).toBeGreaterThanOrEqual(-0.3) expect(s.market).toBeLessThanOrEqual(0.3) }) })