Populate Zul'Aman gear for all 9 classes x 3 specs from the wowtbc.gg page-data JSON, using the same per-phase `bis` extraction (group/raid variant preferred) as the earlier tiers. ZA becomes the fourth phase in PHASE_ORDER and the new default, so the progress bar now measures completion against ZA. Shared lists mirror the existing phase conventions: Discipline = Holy, BM = MM, Combat = Subtlety, and all three warlock specs share one ZA list. Relic entries (idols/librams/totems) stay omitted like T4-T6. Two source corrections are folded in: one site data bug where Holy Paladin's ZA main hand pointed at Hammer of Sanctification (Sunwell only) is replaced with the T6 pick, Crystal Spire of Karabor, and canonical item names replace the site's case/typo variants. Tests: 88 passing, including ZA coverage, shared-list invariants, and latest-phase progress against ZA.
59 lines
2.5 KiB
Markdown
59 lines
2.5 KiB
Markdown
# Amibis Tests
|
||
|
||
Offline unit tests for the Amibis addon's data layer and core logic. No WoW
|
||
client required — the WoW API is mocked (`wow_mocks.lua`).
|
||
|
||
## Running
|
||
|
||
From the repository root, with any Lua 5.3+ interpreter:
|
||
|
||
```bash
|
||
lua5.4 Amibis/Tests/run.lua
|
||
```
|
||
|
||
Exits 0 on success, 1 on any failure, so it works in CI or a git hook.
|
||
|
||
No Lua installed? On Debian/Ubuntu you can get one without root:
|
||
|
||
```bash
|
||
apt-get download lua5.4 && dpkg -x lua5.4_*.deb /tmp/lua && /tmp/lua/usr/bin/lua5.4 Amibis/Tests/run.lua
|
||
```
|
||
|
||
## What is covered
|
||
|
||
| File | Covers |
|
||
|---|---|
|
||
| `test_data.lua` | `BIS_DATA` registry: 9 classes × 3 specs, well-formed slot entries (valid slots, positive item IDs, non-empty names/sources, optional enchant shape), canonical phase order, `ResolvePhase` fallback, shared-list invariants, T4/T5/ZA spot checks |
|
||
| `test_stats.lua` | `ScanItemStats`: MAX aggregation across alias keys (spell damage schools, healing, haste/crit/mp5 ratings), single-mapping pass-through, unmapped key filtering, nil handling |
|
||
| `test_compare.lua` | `CompareGear`: BIS counting, upgrade ranking by stat gain, positive-diffs-only scoring, spec-specific stat keys (Shadow counts spell damage, Holy counts healing), phase resolution, `GetStatKeysForSpec`, `GetCompletionRatio` |
|
||
|
||
## Layout
|
||
|
||
```
|
||
harness.lua # describe/it/expect micro-framework (~150 lines, no deps)
|
||
wow_mocks.lua # WoW API stubs + scriptable item/equipment fixtures
|
||
run.lua # entry point: wires everything together
|
||
test_*.lua # the test suites (receive the addon namespace as vararg)
|
||
```
|
||
|
||
These files are intentionally **not** referenced in `Amibis.toc` — they run on
|
||
your dev machine, never in the game client.
|
||
|
||
## Adding tests
|
||
|
||
- New suite: create `test_<area>.lua`, start with `local _, ns = ...`, use
|
||
`describe` / `before_each` / `it` / `expect(...).toEqual`, and register it in
|
||
`run.lua`.
|
||
- Item/equipment fixtures: set `MockItems[itemID] = { name = ..., stats = {...} }`
|
||
(stats use raw WoW API keys like `ITEM_MOD_INTELLECT_SHORT`; see `STAT_MAP`
|
||
in `Amibis.lua`) and `MockEquipped[inventorySlotID] = itemID`.
|
||
- Inventory slot IDs: Head=1, Neck=2, Shoulder=3, Back=15, Chest=5, Wrist=9,
|
||
Hands=10, Waist=6, Legs=7, Feet=8, Finger0=11, Finger1=12, Trinket0=13,
|
||
Trinket1=14, MainHand=16, SecondaryHand=17, Ranged=18.
|
||
|
||
## Not covered
|
||
|
||
`UI/ComparisonFrame.lua` — its helpers are file-locals and testing them would
|
||
require a full frame API mock. The logic worth testing (stat scanning, scoring,
|
||
phase data) lives in the two suites above.
|