Fix tests
This commit is contained in:
parent
eef6480e75
commit
d81ff1731c
3 changed files with 8 additions and 5 deletions
|
|
@ -76,17 +76,17 @@ func TestExtractTextFromHTML(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "Multiple elements",
|
name: "Multiple elements",
|
||||||
html: "<div><h1>Title</h1><p>Paragraph</p></div>",
|
html: "<div><h1>Title</h1><p>Paragraph</p></div>",
|
||||||
expectedText: "TitleParagraph",
|
expectedText: "Title Paragraph",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "With script tag",
|
name: "With script tag",
|
||||||
html: "<p>Text</p><script>alert('hi')</script><p>More</p>",
|
html: "<p>Text</p><script>alert('hi')</script><p>More</p>",
|
||||||
expectedText: "TextMore",
|
expectedText: "Text More",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "With style tag",
|
name: "With style tag",
|
||||||
html: "<p>Text</p><style>.class { color: red; }</style><p>More</p>",
|
html: "<p>Text</p><style>.class { color: red; }</style><p>More</p>",
|
||||||
expectedText: "TextMore",
|
expectedText: "Text More",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Empty HTML",
|
name: "Empty HTML",
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,8 @@ func TestCalculateHeaderScore(t *testing.T) {
|
||||||
Date: "Mon, 01 Jan 2024 12:00:00 +0000",
|
Date: "Mon, 01 Jan 2024 12:00:00 +0000",
|
||||||
Parts: []MessagePart{{ContentType: "text/plain", Content: "test"}},
|
Parts: []MessagePart{{ContentType: "text/plain", Content: "test"}},
|
||||||
},
|
},
|
||||||
minScore: 40,
|
minScore: 80,
|
||||||
maxScore: 80,
|
maxScore: 90,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Invalid Message-ID format",
|
name: "Invalid Message-ID format",
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,9 @@ Content-Type: text/html; charset=utf-8
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAuthenticationResults(t *testing.T) {
|
func TestGetAuthenticationResults(t *testing.T) {
|
||||||
|
// Force hostname
|
||||||
|
hostname = "example.com"
|
||||||
|
|
||||||
rawEmail := `From: sender@example.com
|
rawEmail := `From: sender@example.com
|
||||||
To: recipient@example.com
|
To: recipient@example.com
|
||||||
Subject: Test Email
|
Subject: Test Email
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue