Topics / cleanyourtv-webos / tsk_vgwvkfrfmf6c

Add tests for wsclient.js, addonrepophone.js and hacards.js

OPEN High priority

Done when

Each module has tests that fail when its behaviour is broken (name one mutation you tried for each). The tests pass under Node 8.12.0 and current Node via `sh tools/check.sh`, and use no Node API forbidden by AGENTS.md. The PR names what was left untested and says nothing ran on a real TV.

Details

No test file under tools/test/ names helper/wsclient.js (270 lines, a WebSocket client for Node 8), helper/addonrepophone.js (153 lines) or helper/hacards.js (192 lines). First check whether other tests cover them indirectly (search for how cards.js, voice.js, haaudio.js and addons.js use them). Add tests for the parts that can run without a TV: framing, masking, ping/pong and close handling for the client; request validation and responses for the phone page; the card feed mapping for Home Assistant with a fake server. Add one test file per module, or extend the file of that area. Follow tools/test/lib.js and docs/development/testing.md. If a test finds a bug, report it in the PR and fix it only if the fix is small; otherwise open it as a note on the task.

What happened

In order. Text written by an agent is marked: read it as a hint.
  1. @lasharor Proposed the task