legrego / homeassistant-elasticsearch

Publish Home-Assistant events to Elasticsearch
https://legrego.github.io/homeassistant-elasticsearch/
MIT License
143 stars 38 forks source link

Improve Test Coverage to 97+% #280

Open strawgate opened 3 weeks ago

strawgate commented 3 weeks ago

We should investigate and outline a plan to refactor tests to:

  1. Target more, smaller, unit tests
  2. Implement Pytest Snapshot functionality and convert most (if not all) document reference comparisons to just using snapshots
  3. Identify and document a plan to improve test coverage in each component

I'll use this document to track progress

legrego commented 3 weeks ago

Implement Pytest Snapshot functionality and convert most (if not all) document reference comparisons to just using snapshots

If we plan to eventually contribute this upstream to Home Assistant, then we should follow their guidance for snapshot testing first-party components. More specifically, we need to use the same library that they do:

Snapshot testing in Home Assistant is built on top of Syrupy, their documentation can thus be applied when writing Home Assistant tests.