Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func parsePartID(partID string) []int {
// formatPartPath converts a Walk path like []int{1, 2, 3} to "1.2.3".
func formatPartPath(path []int) string {
if len(path) == 0 {
return "1"
return ""
}
parts := make([]string, len(path))
for i, p := range path {
Expand Down
14 changes: 14 additions & 0 deletions fetcher/fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ func TestLookupCharsetEncodingAlwaysReturnsNonNil(t *testing.T) {
}
}

func TestFormatPartPathEmptyPath(t *testing.T) {
cases := map[string][]int{
"nil": nil,
"empty": {},
}
for name, path := range cases {
t.Run(name, func(t *testing.T) {
if got := formatPartPath(path); got != "" {
t.Fatalf("formatPartPath(%v) = %q, want empty string", path, got)
}
})
}
}

// TestFetchEmails is an integration test that requires a live IMAP server and valid credentials.
// NOTE: This test will be skipped if it cannot load a configuration file,
// making it safe to run in a CI environment without credentials.
Expand Down
Loading