Skip to content

test: add comma-stripping test#288

Closed
gabrnavarro wants to merge 1 commit intofloatpane:masterfrom
gabrnavarro:bot/task-124-issue-251
Closed

test: add comma-stripping test#288
gabrnavarro wants to merge 1 commit intofloatpane:masterfrom
gabrnavarro:bot/task-124-issue-251

Conversation

@gabrnavarro
Copy link

What changed

Added a test for the comma-stripping behavior in AddContact (config/cache.go). The fix itself (stripping leading/trailing commas from email addresses before saving contacts) was already present at line 156 via strings.Trim(strings.TrimSpace(email), ","), but had no test coverage.

Why

Fixes #251

When users typed an email address in the compose view and a comma was automatically appended (as a separator), the contact was being saved with the trailing comma (e.g. friend@example.com,). On the next save the comma-suffixed version would be stored as a separate contact entry.

The fix ensures commas are stripped from both ends of the email before saving or deduplicating contacts.

Testing

  • Added TestAddContactStripsCommas in config/config_test.go covering trailing comma, leading comma, both commas, no comma, and whitespace+comma cases.
  • All tests pass (go test ./config/... -v -run TestAddContactStripsCommas).
  • Pre-existing view package test failure (TestImageProtocolSupported) is unrelated to this change and was already failing on the base branch.

Signed-off-by: gabrnavarro <gabrnavarro@users.noreply.github.com>
@gabrnavarro gabrnavarro requested a review from andrinoff as a code owner March 13, 2026 16:33
@github-actions github-actions bot added the bug Something isn't working label Mar 13, 2026
@andrinoff andrinoff changed the title Fix: BUG: Contacts saved with commas test: add comma-stripping test Mar 13, 2026
@andrinoff andrinoff removed the bug Something isn't working label Mar 13, 2026
@github-actions github-actions bot added the bug Something isn't working label Mar 13, 2026
@andrinoff
Copy link
Member

andrinoff commented Mar 13, 2026

@gabrnavarro, this PR most likely is botted with no declaration of it in the description. Please, do read Contribution Guide

We'd be happy to work with you, but when You submit the PR with understanding of the changes

@andrinoff andrinoff closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Contacts saved with commas

2 participants