Files
minstrel/internal/mailer/subject_test.go
T
bvandeusenandClaude Opus 5.5 4e1807cbba
release / web (push) Failing after 1m16s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m0s
release / android (push) Successful in 4m34s
release / Build signed APK (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
test: invented artists, albums and MusicBrainz ids in place of real ones
Test data and example comments named real artists, records and songs, and
carried real MusicBrainz ids. One mapping swaps them for invented ones
throughout (Fields of Ontario, Plastic Apes, Marlo Davies, ...), keeping
what each case tests: sort order, index letter, escaping, title keys,
artist-prefix stripping. A test username is no longer the operator's name.

The cover-art and Last.fm connection checks still query real releases;
they reach live services and need something that exists there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 13:21:34 -05:00

26 lines
700 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package mailer
import (
"mime"
"strings"
"testing"
)
func TestEncodeSubject(t *testing.T) {
if got := encodeSubject("Minstrel: 2 updates"); got != "Minstrel: 2 updates" {
t.Errorf("plain ASCII changed: %q", got)
}
enc := encodeSubject("Minstrel: Mochi Shop – XYZ")
if !strings.HasPrefix(enc, "=?utf-8?q?") {
t.Errorf("non-ASCII not RFC 2047 encoded: %q", enc)
}
if dec, err := new(mime.WordDecoder).DecodeHeader(enc); err != nil || dec != "Minstrel: Mochi Shop – XYZ" {
t.Errorf("round trip = %q, %v", dec, err)
}
if got := encodeSubject("Hi\r\nBcc: everyone@example.com"); strings.ContainsAny(got, "\r\n") {
t.Errorf("a line break survived into the header: %q", got)
}
}