-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathxbox_one_test.go
39 lines (33 loc) · 1 KB
/
xbox_one_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
37
38
39
package devices
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestNewXboxOne(t *testing.T) {
Convey("Given a user agent string", t, func() {
So(NewXboxOne(NewUAParser(testDevices["xbox-one-1"])), ShouldHaveSameTypeAs, &XboxOne{})
})
}
func TestXboxOneName(t *testing.T) {
Convey("Subject: #Name", t, func() {
Convey("It should return Xbox One", func() {
s := NewXboxOne(NewUAParser(""))
So(s.Name(), ShouldEqual, "Xbox One")
})
})
}
func TestXboxOneMatch(t *testing.T) {
Convey("Subject: #Match", t, func() {
Convey("When the user agent matches", func() {
Convey("It should return true", func() {
So(NewXboxOne(NewUAParser(testDevices["xbox-one-1"])).Match(), ShouldBeTrue)
So(NewXboxOne(NewUAParser(testDevices["xbox-one-2"])).Match(), ShouldBeTrue)
})
})
Convey("When the user agent does not match", func() {
Convey("It should return false", func() {
So(NewXboxOne(NewUAParser(testDevices["bb-playbook-1"])).Match(), ShouldBeFalse)
})
})
})
}