MCPcopy Create free account
hub / github.com/buggregator/server / TestSMTPAPI_Links_NoDuplicates

Function TestSMTPAPI_Links_NoDuplicates

modules/smtp/api_test.go:366–385  ·  view source on GitHub ↗

TestSMTPAPI_Links_NoDuplicates verifies that the same URL in HTML and text is deduplicated (HTML wins).

(t *testing.T)

Source from the content-addressed store, hash-verified

364// TestSMTPAPI_Links_NoDuplicates verifies that the same URL in HTML and text
365// is deduplicated (HTML wins).
366func 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.
388func TestSMTPAPI_Codes(t *testing.T) {

Callers

nothing calls this directly

Calls 3

setupAPITestFunction · 0.85
storeSMTPEventFunction · 0.85
ServeHTTPMethod · 0.80

Tested by

no test coverage detected