Skip to content

Commit

Permalink
User: add unit test for String()
Browse files Browse the repository at this point in the history
  • Loading branch information
TerraTalpi committed Aug 19, 2021
1 parent f91348a commit 9a79e8b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions User_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package msgraph

import (
"fmt"
"testing"
"time"
)
Expand Down Expand Up @@ -134,3 +135,26 @@ func TestUser_ListCalendarView(t *testing.T) {
})
}
}

func TestUser_String(t *testing.T) {
u := GetTestUser(t)
tt := struct {
name string
u *User
want string
}{
name: "Test user func String",
u: &u,
want: fmt.Sprintf("User(ID: \"%v\", BusinessPhones: \"%v\", DisplayName: \"%v\", GivenName: \"%v\", "+
"Mail: \"%v\", MobilePhone: \"%v\", PreferredLanguage: \"%v\", Surname: \"%v\", UserPrincipalName: \"%v\", "+
"ActivePhone: \"%v\", DirectAPIConnection: %v)",
u.ID, u.BusinessPhones, u.DisplayName, u.GivenName, u.Mail, u.MobilePhone, u.PreferredLanguage, u.Surname,
u.UserPrincipalName, u.activePhone, u.graphClient != nil),
}

t.Run(tt.name, func(t *testing.T) {
if got := tt.u.String(); got != tt.want {
t.Errorf("User.String() = %v, want %v", got, tt.want)
}
})
}

0 comments on commit 9a79e8b

Please sign in to comment.