- Introduced new endpoints for contact discovery, including scanning, listing, and managing discovered contacts. - Implemented retry logic for handling missing DAV credentials during contact operations. - Added public share functionality for drive API, allowing users to manage public shares, including upload, delete, and rename operations. - Updated Nextcloud configuration to support public share links and improved error handling for public share permissions. - Enhanced logging and validation across contact and drive APIs for better error tracking and user feedback. - Added tests for new contact matching and ranking functionalities to ensure accuracy and reliability.
74 lines
1.4 KiB
Go
74 lines
1.4 KiB
Go
package discovery
|
|
|
|
import "testing"
|
|
|
|
func TestProfileHasValueBeyondEmail(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
p Profile
|
|
want bool
|
|
}{
|
|
{
|
|
name: "email only",
|
|
p: Profile{
|
|
PrimaryEmail: "alice@corp.com",
|
|
DisplayName: "",
|
|
},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "display name equals local part",
|
|
p: Profile{
|
|
PrimaryEmail: "alice@corp.com",
|
|
DisplayName: "alice",
|
|
},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "meaningful display name",
|
|
p: Profile{
|
|
PrimaryEmail: "alice@corp.com",
|
|
DisplayName: "Alice Martin",
|
|
},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "signature",
|
|
p: Profile{
|
|
PrimaryEmail: "alice@corp.com",
|
|
Signatures: []SignatureEntry{{
|
|
SignatureText: "Alice Martin\nCorp",
|
|
}},
|
|
},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "enriched company",
|
|
p: Profile{
|
|
PrimaryEmail: "alice@corp.com",
|
|
EnrichedData: &EnrichedContactData{Company: "Corp"},
|
|
},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "all emails display name",
|
|
p: Profile{
|
|
PrimaryEmail: "alice@corp.com",
|
|
AllEmails: []EmailEntry{{
|
|
Email: "alice@corp.com",
|
|
DisplayName: "Alice Martin",
|
|
}},
|
|
},
|
|
want: true,
|
|
},
|
|
}
|
|
|
|
for _, tc := range tests {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if got := ProfileHasValueBeyondEmail(tc.p); got != tc.want {
|
|
t.Fatalf("ProfileHasValueBeyondEmail() = %v, want %v", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|