diff options
Diffstat (limited to 'internal/host/host_test.go')
-rw-r--r-- | internal/host/host_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/host/host_test.go b/internal/host/host_test.go new file mode 100644 index 00000000..8395d3fc --- /dev/null +++ b/internal/host/host_test.go @@ -0,0 +1,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))) +} |