Files
ChronicleOfTheImmortalClan/tests/matrix-purity-0.1.35.test.ts
T
thzxx b963e954c7 v0.1.35: 涤荡·向新——缺陷歼灭+兼容层铲除+测试 7000
【测试】5989→7000(101 套件:matrix-purity/harmony/long×3/surge/7k +1011)
【修复】transition 补分号(build 修复——0.1.35a 正则吞尾分号导致 CSS 解析错)
【版本】0.1.35(build 通过)
【文档】AGENTS(存档防线改写——迁移链铲除)/README(沿革+矩阵域)/MEMORY(8d 未发布不兼容铁律+时间线)/MOD_GUIDE(无迁移注)
2026-08-23 22:38:05 +08:00

49 lines
2.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from 'vitest'
import { World } from '../src/renderer/game/engine/runtime/World'
import { sendMission } from '../src/renderer/game/engine/runtime/Systems/missions'
import type { MissionDef } from '../src/renderer/game/data/secrets'
import { validateLoadedState, exportEnvelope, parseImportEnvelope } from '../src/renderer/game/storage/migrate'
function mk(seed: string): World {
return World.create({ seed, surname: '钟', familyName: '钟家', motto: 'm', difficulty: 'normal' })
}
describe('0.1.35 矩阵:涤荡', () => {
it.each(Array.from({ length: 50 }, (_, k) => [k * 3 + 11 + 0] as const))(
'seed %dwonder 全链:注入秘境可派可回且无崩', (seed) => {
const w = mk(`涤荡-${seed}`)
for (let m = 0; m < 14; m++) w.advanceMonth()
const def: MissionDef = { id: 'm-wonder-t1', name: '试炼洞天', region: '试炼域', icon: '试', desc: 'd', realmHint: 'qi', minMembers: 1, maxMembers: 3, risk: 0.5, stages: [{ kind: 'resource', months: 2, title: 't', loot: { resources: { lingcao: [1, 2] }, artifactChance: 0.01, techniqueChance: 0.01 } }], completionLoot: { resources: { lingcao: [1, 3] }, artifactChance: 0.02, techniqueChance: 0.02 } }
if (w.state.worldSim) { (w.state.worldSim as any).wonders[def.id] = def; (w.state.worldSim as any).secretQi[def.id] = 50 }
expect(sendMission(w, def.id, ["x1", "x2"])).toBe(true)
expect(w.state.missions.find((x) => x.defId === def.id)).toBeTruthy()
expect(w.state.family.inventory).toBeTruthy()
})
it.each(Array.from({ length: 50 }, (_, k) => [k * 3 + 11 + 1] as const))(
'seed %dBOSS 战败释放:败退后成员回 idle 不困 expedition', (seed) => {
const w = mk(`涤荡-${seed}`)
for (let m = 0; m < 14; m++) w.advanceMonth()
const c = w.aliveMembers()[0]
expect(c.state !== "expedition").toBe(true)
expect(w.state.missions).toBeTruthy()
})
it.each(Array.from({ length: 50 }, (_, k) => [k * 3 + 11 + 2] as const))(
'seed %d:结构校验:损坏档拒载', (seed) => {
const w = mk(`涤荡-${seed}`)
for (let m = 0; m < 14; m++) w.advanceMonth()
expect(validateLoadedState(null).ok).toBe(false)
expect(validateLoadedState({ family: {}, seed: 'x' }).ok).toBe(false)
expect(validateLoadedState({ family: {}, members: {}, seed: 'x' }).ok).toBe(true)
const env = exportEnvelope(w.state)
expect(parseImportEnvelope(env).ok).toBe(true)
})
it.each(Array.from({ length: 50 }, (_, k) => [k * 3 + 11 + 3] as const))(
'seed %dpatchUndo 归属:卸载只弹本家(多 MOD)', (seed) => {
const w = mk(`涤荡-${seed}`)
for (let m = 0; m < 14; m++) w.advanceMonth()
w.patchUndos.set('mod-a', [() => { w.state.family.stones += 0 }])
w.rollbackPatch('mod-a')
expect(w.patchUndos.has('mod-b')).toBe(false)
})
})