-
Notifications
You must be signed in to change notification settings - Fork 38
/
supportedTimeZones_test.go
36 lines (31 loc) · 1.22 KB
/
supportedTimeZones_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package msgraph
import (
"math/rand"
"testing"
)
func Test_supportedTimeZones_GetTimeZoneByAlias(t *testing.T) {
testuser := GetTestUser(t)
timezones, _ := testuser.getTimeZoneChoices(compileGetQueryOptions(nil))
randomTimezone := timezones.Value[rand.Intn(len(timezones.Value))]
_, err := timezones.GetTimeZoneByAlias(randomTimezone.Alias)
if err != nil {
t.Errorf("Cannot get timeZone with Alias %v, err: %v", randomTimezone.Alias, err)
}
_, err = timezones.GetTimeZoneByAlias("This is a non existing timezone")
if err == nil {
t.Errorf("Tried to get a non existing timezone, expected an error, but got nil")
}
}
func Test_supportedTimeZones_GetTimeZoneByDisplayName(t *testing.T) {
testuser := GetTestUser(t)
timezones, _ := testuser.getTimeZoneChoices(compileGetQueryOptions(nil))
randomTimezone := timezones.Value[rand.Intn(len(timezones.Value))]
_, err := timezones.GetTimeZoneByDisplayName(randomTimezone.DisplayName)
if err != nil {
t.Errorf("Cannot get timeZone with DisplayName %v, err: %v", randomTimezone.DisplayName, err)
}
_, err = timezones.GetTimeZoneByDisplayName("This is a non existing timezone")
if err == nil {
t.Errorf("Tried to get a non existing timezone, expected an error, but got nil")
}
}