TestSMTPAPI_Links_NoDuplicates verifies that the same URL in HTML and text is deduplicated (HTML wins).
(t *testing.T)
| 364 | // TestSMTPAPI_Links_NoDuplicates verifies that the same URL in HTML and text |
| 365 | // is deduplicated (HTML wins). |
| 366 | func TestSMTPAPI_Links_NoDuplicates(t *testing.T) { |
| 367 | mux, store, _ := setupAPITest(t) |
| 368 | |
| 369 | storeSMTPEvent(t, store, "dup-uuid1", ParsedEmail{ |
| 370 | Subject: "Test", |
| 371 | HTML: `<a href="https://example.com">Click</a>`, |
| 372 | Text: "https://example.com", |
| 373 | }, 1000.0, "default") |
| 374 | |
| 375 | r := httptest.NewRequest("GET", "/api/smtp/message/dup-uuid1/links", nil) |
| 376 | w := httptest.NewRecorder() |
| 377 | mux.ServeHTTP(w, r) |
| 378 | |
| 379 | var resp map[string]any |
| 380 | json.NewDecoder(w.Body).Decode(&resp) |
| 381 | data := resp["data"].([]any) |
| 382 | if len(data) != 1 { |
| 383 | t.Errorf("expected 1 unique link, got %d", len(data)) |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | // TestSMTPAPI_Codes verifies OTP code extraction. |
| 388 | func TestSMTPAPI_Codes(t *testing.T) { |
nothing calls this directly
no test coverage detected