29 lines
750 B
C#
29 lines
750 B
C#
using FluentAssertions;
|
|
using InboxIntel.Infrastructure.Gmail;
|
|
using Xunit;
|
|
|
|
namespace InboxIntel.UnitTests;
|
|
|
|
public class UnsubscribeExtractionTests
|
|
{
|
|
[Fact]
|
|
public void Prefers_http_link()
|
|
{
|
|
var raw = "<mailto:unsub@x.com>, <https://x.com/unsub?id=42>";
|
|
GmailMessageParser.ExtractUnsubscribeTarget(raw).Should().Be("https://x.com/unsub?id=42");
|
|
}
|
|
|
|
[Fact]
|
|
public void Falls_back_to_mailto()
|
|
{
|
|
var raw = "<mailto:unsubscribe@news.example.com>";
|
|
GmailMessageParser.ExtractUnsubscribeTarget(raw).Should().Be("mailto:unsubscribe@news.example.com");
|
|
}
|
|
|
|
[Fact]
|
|
public void Null_when_absent()
|
|
{
|
|
GmailMessageParser.ExtractUnsubscribeTarget(null).Should().BeNull();
|
|
}
|
|
}
|