feat(store): add account from_address field + v2 migration
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -84,3 +84,30 @@ func TestListAccountsOmitsSecrets(t *testing.T) {
|
||||
t.Fatal("ListAccounts must not return secrets")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendFromFallsBackToUsername(t *testing.T) {
|
||||
a := Account{Username: "login@example.com"}
|
||||
if got := a.SendFrom(); got != "login@example.com" {
|
||||
t.Fatalf("blank from-address should fall back to username, got %q", got)
|
||||
}
|
||||
a.FromAddress = "Steve Cliff <me@stevecliff.com>"
|
||||
if got := a.SendFrom(); got != "Steve Cliff <me@stevecliff.com>" {
|
||||
t.Fatalf("set from-address should win, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddGetAccountRoundTripsFromAddress(t *testing.T) {
|
||||
s := openTemp(t)
|
||||
a := sampleAccount()
|
||||
a.FromAddress = "Steve Cliff <me@stevecliff.com>"
|
||||
if _, err := s.AddAccount(a); err != nil {
|
||||
t.Fatalf("AddAccount: %v", err)
|
||||
}
|
||||
got, err := s.GetAccount("work")
|
||||
if err != nil {
|
||||
t.Fatalf("GetAccount: %v", err)
|
||||
}
|
||||
if got.FromAddress != "Steve Cliff <me@stevecliff.com>" {
|
||||
t.Fatalf("FromAddress not round-tripped: %q", got.FromAddress)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user