-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsamsung_test.go
45 lines (39 loc) · 1.34 KB
/
samsung_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
40
41
42
43
44
45
package devices
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestNewSamsung(t *testing.T) {
Convey("Subject: #NewSamsung", t, func() {
Convey("It returns a Samsung platform", func() {
s := NewSamsung(NewUAParser(testDevices["samsung-1"]))
So(s, ShouldHaveSameTypeAs, &Samsung{})
})
})
}
func TestSamsungName(t *testing.T) {
Convey("Subject: #Name", t, func() {
Convey("It returns the correct name", func() {
So(NewSamsung(NewUAParser(testDevices["samsung-1"])).Name(), ShouldEqual, "Samsung SM-N900")
So(NewSamsung(NewUAParser(testDevices["samsung-2"])).Name(), ShouldEqual, "Samsung SM-J700F")
So(NewSamsung(NewUAParser(testDevices["samsung-3"])).Name(), ShouldEqual, "Samsung SM-G928K")
})
})
}
func TestSamsungMatch(t *testing.T) {
Convey("Subject: #Match", t, func() {
Convey("When the user agent matches", func() {
Convey("It returns true", func() {
So(NewSamsung(NewUAParser(testDevices["samsung-1"])).Match(), ShouldBeTrue)
So(NewSamsung(NewUAParser(testDevices["samsung-2"])).Match(), ShouldBeTrue)
So(NewSamsung(NewUAParser(testDevices["samsung-3"])).Match(), ShouldBeTrue)
})
})
Convey("When the user agent does not match", func() {
Convey("It returns false", func() {
s := NewSamsung(NewUAParser(testDevices["iphone-7"]))
So(s.Match(), ShouldBeFalse)
})
})
})
}