-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
gotty-client_test.go
41 lines (35 loc) · 1016 Bytes
/
gotty-client_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
package gottyclient
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestParseURL(t *testing.T) {
Convey("Testing ParseURL", t, func() {
Convey("Complete URLs", func() {
input := "http://test.com:8888/blahblah/blihblih"
output, err := ParseURL(input)
So(err, ShouldBeNil)
So(output, ShouldEqual, input)
input = "https://test.com:8888/blahblah/blihblih"
output, err = ParseURL(input)
So(err, ShouldBeNil)
So(output, ShouldEqual, input)
input = "https://test.com:8888"
output, err = ParseURL(input)
So(err, ShouldBeNil)
So(output, ShouldEqual, input)
})
Convey("Incomplete URLs", func() {
input := "test.com:8888/blahblah/blihblih"
expected := "http://test.com:8888/blahblah/blihblih"
output, err := ParseURL(input)
So(err, ShouldBeNil)
So(output, ShouldEqual, expected)
input = "test.com"
expected = "http://test.com"
output, err = ParseURL(input)
So(err, ShouldBeNil)
So(output, ShouldEqual, expected)
})
})
}