carlos / platform Public

Merge main into staticcheck-sa4006

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 00a790c2794ee29126599329e097f8e139fa0b52 parent 5528f4eparent 44585d7
1 file changed, +8 −1
  • internal/console/billingusage_test.go +8 −1

CI failed — run details

diff --git a/internal/console/billingusage_test.go b/internal/console/billingusage_test.go
index b071d2ec4..7a3b17176 100644
--- a/internal/console/billingusage_test.go
+++ b/internal/console/billingusage_test.go
@@ -49,6 +49,9 @@ func changeRow(t *testing.T, body, name string) string {
return m[1]
}
+// markupTags matches every tag, attributes and all, to read a row's text.
+var markupTags = regexp.MustCompile(`<[^>]*>`)
+
// useSpan is the usage element a row or card carries, "" for none.
var useSpan = regexp.MustCompile(`<(?:span|dd) class="[^"]*\buse\b[^"]*">[^<]*</(?:span|dd)>`)
@@ -138,7 +141,11 @@ func TestBillingPageUsageStalePeriodUnknown(t *testing.T) {
if got := useOf(t, row); got != unknown {
t.Errorf("%s: usage %q, want %q", pack, got, unknown)
}
- if strings.Contains(row, "999") || strings.Contains(row, "70 GB") || strings.Contains(row, esc(fmt.Sprintf(billingCopy["usage.of_today"], "0", "1,000"))) {
+ // The row's visible text, not its markup: a form's CSRF token or an
+ // attribute value contains "999" now and then, which failed this
+ // test by chance on CI (main at a23423b7).
+ text := markupTags.ReplaceAllString(row, " ")
+ if strings.Contains(text, "999") || strings.Contains(text, "70 GB") || strings.Contains(text, esc(fmt.Sprintf(billingCopy["usage.of_today"], "0", "1,000"))) {
t.Errorf("%s: a stale row shows as a figure:\n%s", pack, row)
}
}