Commit 581cfab
committed
test(status): cover the remaining branches in the alert fold
codecov/patch flagged 94% against the 99% gate. Branch coverage on
service-status.ts was 92.3%, with three arms of the per-component fold
unexercised -- all of them in the paths that decide what a malformed or
partial alert does:
• a `service` label that is not a string. Alertmanager's contract says
Record<string, string>, but this reads a parsed JSON body from a source that
can ship anything, and a non-string must take the same ignore path an
unmapped label takes rather than throwing on .toLowerCase();
• a firing alert with no usable `startsAt`. Still degraded -- an alert with no
timestamp is still an alert -- but no invented `since`;
• the KEEP arms of the earliest-wins comparison. The existing test put the
earlier alert second, which only exercises the replace arm; the mirror case
(earlier first, and a later untimestamped one) leaves half the comparison
free to invert unnoticed.
Branch coverage is now 100% (39/39), statements and lines already were.
No production code changed.1 parent ac6c046 commit 581cfab
1 file changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
123 | 154 | | |
124 | 155 | | |
125 | 156 | | |
| |||
0 commit comments