blob: 8395d3fc2ffafca61598a77625e79ef97ff3b584 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package host
import (
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFromString(t *testing.T) {
assert.Equal(t, "example.com", FromString("example.com"))
assert.Equal(t, "example.com", FromString("eXAmpLe.com"))
assert.Equal(t, "example.com", FromString("example.com:8080"))
}
func TestFromRequest(t *testing.T) {
assert.Equal(t, "example.com", FromRequest(httptest.NewRequest("GET", "example.com:8080/123", nil)))
}
|