Files
arne 48488b72b5
Build and Push Docker Image / build-and-push (push) Successful in 2m21s
feat: Add Gmail Catchall Labeler service with configuration and functionality
- Introduced a new Docker Compose configuration for the Gmail Catchall Labeler service.
- Implemented GmailOptions class for managing configuration settings.
- Developed GmailApiClient to interact with the Gmail API, including methods for fetching messages and managing labels.
- Created models for Gmail messages, labels, and headers.
- Added IGmailClient interface to define the contract for Gmail client implementations.
- Implemented GmailOrganizer to handle the organization of emails based on recipient addresses.
- Developed LabelNameResolver for generating label names based on local parts of email addresses.
- Created RecipientExtractor to extract local parts from email headers.
- Implemented state management with OrganizerState and StateStore for persisting state information.
- Added Worker class to manage the background processing of email organization.
- Created unit tests for GmailOrganizer, LabelNameResolver, and RecipientExtractor to ensure functionality.
- Added necessary project files and configurations for building and running the application.
2026-09-26 20:05:21 +02:00

27 lines
893 B
C#

using GmailCatchallLabeler.Labels;
namespace GmailCatchallLabeler.Tests;
public sealed class LabelNameResolverTests
{
[Theory]
[InlineData("every-foods", "ArneM.be/Every Foods")]
[InlineData("science_alert", "ArneM.be/Science Alert")]
[InlineData("energyid", "ArneM.be/Energyid")]
public void Resolve_UsesAutomaticTitleCasing(string localPart, string expected)
{
var resolver = new LabelNameResolver("ArneM.be", "{}");
Assert.Equal(expected, resolver.Resolve(localPart));
}
[Theory]
[InlineData("tomscott", "ArneM.be/Tom Scott")]
[InlineData("TOMSCOTT", "ArneM.be/Tom Scott")]
public void Resolve_PrefersCaseInsensitiveOverride(string localPart, string expected)
{
var resolver = new LabelNameResolver("ArneM.be/", "{\"tomscott\":\"Tom Scott\"}");
Assert.Equal(expected, resolver.Resolve(localPart));
}
}