Skip to content

test: add sync-validation tests for config strings and translations#1448

Open
florianhorner wants to merge 2 commits intobasnijholt:mainfrom
florianhorner:test/strings-sync-validation
Open

test: add sync-validation tests for config strings and translations#1448
florianhorner wants to merge 2 commits intobasnijholt:mainfrom
florianhorner:test/strings-sync-validation

Conversation

@florianhorner
Copy link
Copy Markdown

Summary

  • Adds tests/test_strings_sync.py with 6 tests that prevent drift between strings.json, en.json, services.yaml, and translation files
  • Tests use only stdlib + yaml (no homeassistant dependency) so they can run without the HA test environment
  • Validates: strings.json ↔ en.json structure, translation file step/error key coverage, services.yaml field documentation, error key completeness

Tests

  1. test_strings_and_en_json_step_keys_match — step names match between strings.json and en.json
  2. test_translation_files_have_step_structure — all 38 translation files define the same step keys
  3. test_translation_files_have_error_keys — all translation files define the same error keys
  4. test_services_yaml_fields_have_descriptions — every service field has a description
  5. test_error_keys_cover_config_flow — error keys in strings.json cover what config_flow.py uses
  6. test_en_json_matches_strings_json_options — en.json and strings.json options are structurally identical

Motivation

Currently there's no automated check that UI strings, service descriptions, and translations stay in sync. These tests catch missing keys, structural drift, and undocumented fields before they ship.

Test plan

  • Ruff lint passes
  • Syntax validation passes
  • CI pytest run

🤖 Generated with Claude Code

Adds 6 tests that prevent drift between strings.json, en.json,
translation files, and services.yaml. Tests use only stdlib + yaml
(no homeassistant dependency) so they run without the HA test env.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant