mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
3c732f1c1a
The three reducers that drive the InfoStand pilot (applyUserBadgesUpdate / applyUserFigureUpdate / applyFavouriteGroupUpdate, in src/hooks/rooms/widgets/avatarInfo.reducers.ts) have been live for ~10 commits without coverage. They encode non-trivial branches: 'state not AvatarInfoUser' bail-out, 'event for different user / roomIndex' bail-out, dedup-equality bail-out, and the clearGroup logic (status === -1 || habboGroupId <= 0). Add tests pinning every branch. Two import-tightening tweaks made the reducer module itself testable in jsdom without dragging the renderer SDK in: - Renderer event types are now type-only imports — they're erased at compile time, so the runtime module load of @nitrots/nitro-renderer is skipped. The reducer body only reads plain event fields (no ) so this is safe. - AvatarInfoUser / dedupeBadges / IAvatarInfo come from concrete file paths instead of '../../../api' (the barrel pulls in Pixi-bound modules via the renderer side-imports). Tests cover each branch by constructing AvatarInfoUser via the actual class (so the instanceof guard hits) and casting plain event objects through for the typed parameter. Net Vitest count: 99 -> 113 (8 test files).