forked from iopipe/turtle-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resource_path_test.go
46 lines (41 loc) · 834 Bytes
/
resource_path_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
46
package main
import (
"testing"
)
func TestDereferencePath(t *testing.T) {
url, err := dereferencePath("https://www.iopipe.com/")
if err != nil {
t.Error(err)
}
if url.Scheme != "https" {
t.Error("Expected https")
}
}
func TestDereferencePathPlainString(t *testing.T) {
url, err := dereferencePath("plainstring")
if err != nil {
t.Error(err)
}
if url.Scheme != "https" {
t.Error("Expected https")
}
}
func TestDereferencePathHTTP(t *testing.T) {
url, err := dereferencePath("http://address")
if err != nil {
t.Error(err)
}
if url.Scheme != "http" {
t.Error("Expected http")
}
}
func TestDereferenceObj(t *testing.T) {
url, err := dereferencePath("http://127.0.0.1")
if err != nil {
t.Error(err)
}
obj := dereferenceObj(url)
if url != obj.path {
t.Error("URL and url.path did not match")
}
}