diablo2-web/tests
troytt ad7ced6760 test: 修复三处跳过守卫,它们只在真实资源到位时才暴露
这三个测试都犯了同一个错误:**守卫检查的资源,和实际读取的资源不是同
一个**。在 `samples/d2` 缺席时它们一律静默跳过,看起来是绿的;真实 MPQ
一旦放进来,守卫放行,然后立刻炸在一个完全无关的缺失文件上。

- `tests/dcc.test.ts`
  守卫看 `samples/d2`,扫描目标却硬编码成 `samples/fixtures`——那里没有
  `d2char.mpq`。于是这个套件**从来没有真正跑过**:没资源时跳过,有资源时
  `TypeError: Cannot read properties of null (reading 'listFiles')`。
  目标改为 `samples/d2`;打开归档失败时由"打日志后继续"改为 `throw`
  并带上归档名,避免把"文件缺失"伪装成 100 行之外的空指针;
  `let characters: any` 收紧为 `MpqArchive | null`。

- `tests/widths.test.ts`
  守卫看 `samples/d2`,真实输入却是一个空成员名和
  `scripts/browser/checks/map-widths.txt`——后者在仓库里从未存在过。
  改为按实际输入判断。顺带补 `: string` 标注,否则空字符串字面量会被
  收窄成 `never`。

- `tests/formats-malformed.test.ts`
  守卫看 `samples/d2` 目录是否存在,却去读其中一个散落的 `.cof`。但
  `samples/d2/` 放的是 MPQ **归档**,不是解包后的目录树,目录存在完全
  不能说明那个文件存在。改为直接判断该文件路径。

修复后,在真实 MPQ 就位的情况下:
21 passed | 1 skipped (22 files),421 passed | 2 skipped (423),tsc 0 error。
其中 `dcc.test.ts` 从"0 个测试"变成真正执行。
2026-09-14 14:51:50 +00:00
..
fixtures feat(mpq): 实现 ADPCM 与 Huffman 音频解码并接入 Web Audio (fixes #13) 2026-09-14 12:30:21 +00:00
collision-orientation.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
combat.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
dc6.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
dcc.test.ts test: 修复三处跳过守卫,它们只在真实资源到位时才暴露 2026-09-14 14:51:50 +00:00
engine.test.ts feat: 将所有动态实体加入地形深度排序渲染列队 (fixes #10) 2026-09-14 12:40:48 +00:00
formats-malformed.test.ts test: 修复三处跳过守卫,它们只在真实资源到位时才暴露 2026-09-14 14:51:50 +00:00
implode.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
items.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
lockstep-hash.test.ts refactor(lockstep): 按项目规范彻底移除 any 约束逃逸并优化哈希分配性能 (refs #7) 2026-09-14 13:05:18 +00:00
m4.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
m5.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
mpq-audio.test.ts feat(mpq): 实现 ADPCM 与 Huffman 音频解码并接入 Web Audio (fixes #13) 2026-09-14 12:30:21 +00:00
mpq-roundtrip.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
net-scene-integration.test.ts refactor(lockstep): 按项目规范彻底移除 any 约束逃逸并优化哈希分配性能 (refs #7) 2026-09-14 13:05:18 +00:00
net.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
npc-paths.test.ts fix(art): 将 NPC 渲染文件的基础寻址从 objects 修正为 monsters 2026-09-14 13:08:46 +00:00
object-lookup.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
reader.test.ts feat(formats): 添加安全的二进制数据读取器 2026-09-14 13:19:01 +00:00
save-schema.test.ts fix(game): 移除不安全的类型转换并增加存档校验 (refs #7) 2026-09-14 12:44:19 +00:00
tbl.test.ts fix(formats): 按官方哈希桶格式重写 tbl 解码器与编码器 (fixes #8) 2026-09-14 12:30:07 +00:00
tiles.test.ts test: 引入 Vitest 测试框架、覆盖率统计与 CI 流水线 (fixes #14) 2026-09-14 12:25:28 +00:00
widths.test.ts test: 修复三处跳过守卫,它们只在真实资源到位时才暴露 2026-09-14 14:51:50 +00:00