From 25709abf8dfc1cbb2a49415b772b09e37e8e1dee Mon Sep 17 00:00:00 2001 From: acidburns Date: Fri, 20 Feb 2026 21:34:52 +0100 Subject: [PATCH] docs: add legacy unity test guide --- docs/TESTS.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/TESTS.md diff --git a/docs/TESTS.md b/docs/TESTS.md new file mode 100644 index 0000000..ca4031b --- /dev/null +++ b/docs/TESTS.md @@ -0,0 +1,48 @@ +# Legacy Unity Tests + +This change intentionally keeps the existing PlatformIO legacy Unity harness unchanged. +No `platformio.ini`, CI, or test-runner configuration was modified. + +## Compile-Only (Legacy Gate) + +Use compile-only checks in environments that do not have a connected board: + +```powershell +pio test -e lilygo-t3-v1-6-1-test --without-uploading --without-testing +pio test -e lilygo-t3-v1-6-1-868-test --without-uploading --without-testing +``` + +Suite-specific compile checks: + +```powershell +pio test -e lilygo-t3-v1-6-1-test --without-uploading --without-testing -f test_html_escape +pio test -e lilygo-t3-v1-6-1-test --without-uploading --without-testing -f test_payload_codec +pio test -e lilygo-t3-v1-6-1-test --without-uploading --without-testing -f test_lora_transport +pio test -e lilygo-t3-v1-6-1-test --without-uploading --without-testing -f test_json_codec +pio test -e lilygo-t3-v1-6-1-test --without-uploading --without-testing -f test_refactor_smoke +``` + +## Full On-Device Unity Run + +When hardware is connected, run full legacy Unity tests: + +```powershell +pio test -e lilygo-t3-v1-6-1-test +pio test -e lilygo-t3-v1-6-1-868-test +``` + +## Suite Coverage + +- `test_html_escape`: `html_escape`, `url_encode_component`, and `sanitize_device_id` edge/adversarial coverage. +- `test_payload_codec`: payload schema v3 roundtrip/reject paths and golden vectors. +- `test_lora_transport`: CRC16, frame encode/decode integrity, and chunk reassembly behavior. +- `test_json_codec`: state JSON key stability and Home Assistant discovery payload manufacturer/key stability. +- `test_refactor_smoke`: baseline include/type smoke and manufacturer constant guard. + +## Manufacturer Drift Guard + +Run the static guard script to enforce Home Assistant manufacturer wiring: + +```powershell +powershell -ExecutionPolicy Bypass -File test/check_ha_manufacturer.ps1 +```