Commit c1c4995
committed
test(gtm): unit tests + fix unreachable gtm_only_firing status
Adds 50 unit tests covering:
- All pure-function parsers in gtm/read.py: _params_dict,
_summarize_filter (including negate-flag rendering),
_resolve_trigger (custom + built-in IDs), _trigger_group_member_ids,
_element_visibility_summary (case-insensitive selectorType),
_parse_trigger (type-specific dispatch), _parse_variable.
- audit_event_coverage status determination — one test per status
code (ok, no_tag_no_fire, tag_paused, tag_active_but_not_firing,
ok_auto_collected, ga4_fires_no_tag, gtm_only_firing,
gtm_only_not_firing, auto_event_only, ga4_only).
- Insight generation for the four most common gap categories:
missing tag, paused tag, dynamic-event tag, custom HTML tag.
- Matrix shape contracts: required keys, container summary,
GA4 error short-circuit, alphabetical event sort.
Tests caught a real bug: the `ok` status was matched on
`in_gtm AND any_active_tag AND ga4_fires` without requiring
`in_codebase`, making `gtm_only_firing` (intended semantics:
\"event fires from a GTM tag but isn't in the codebase, possibly
stale\") unreachable. Fixed by adding `in_codebase` to the `ok`
condition. No user-facing surface area change for events that ARE
in the codebase — only events not in the codebase but with active
firing tags are affected, and they now correctly route to
gtm_only_firing instead of the over-eager ok.
234 tests pass (was 184 baseline + 50 new from this commit).1 parent 440e695 commit c1c4995
2 files changed
Lines changed: 645 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
637 | | - | |
| 637 | + | |
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
| |||
0 commit comments