-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmedusa_test.go
37 lines (27 loc) · 992 Bytes
/
medusa_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
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_checkStatusCode(t *testing.T) {
status := checkStatusCode([]string{"200", "301"}, "200")
assert.True(t, status)
status = checkStatusCode([]string{"200", "301"}, "404")
assert.False(t, status)
}
func Test_generateURL(t *testing.T) {
url := generateURL("rizasabuncu.com")
assert.Equal(t, "http://rizasabuncu.com/", url)
url = generateURL("rizasabuncu.com/admin")
assert.Equal(t, "http://rizasabuncu.com/admin/", url)
url = generateURL("https://rizasabuncu.com/")
assert.Equal(t, "https://rizasabuncu.com/", url)
url = generateURL("https://rizasabuncu.com/admin")
assert.Equal(t, "https://rizasabuncu.com/admin/", url)
url = generateURL("https://rizasabuncu.com/admin/dashboard")
assert.Equal(t, "https://rizasabuncu.com/admin/dashboard/", url)
}
func Test_parseStatusCode(t *testing.T) {
statusCodes := parseStatusCode("200,301")
assert.Equal(t, []string{"200", "301"}, statusCodes)
}