From 4aa79b1dd518a6e42d10e4c64eec2a1ca2cd2a58 Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Fri, 10 Dec 2021 17:00:13 +0530 Subject: [PATCH] feat: add test for url utils --- server/utils/urls_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 server/utils/urls_test.go diff --git a/server/utils/urls_test.go b/server/utils/urls_test.go new file mode 100644 index 0000000..b7a0887 --- /dev/null +++ b/server/utils/urls_test.go @@ -0,0 +1,25 @@ +package utils + +import "testing" + +func TestGetHostName(t *testing.T) { + authorizer_url := "http://test.herokuapp.com" + + got := GetHostName(authorizer_url) + want := "test.herokuapp.com" + + if got != want { + t.Errorf("GetHostName Test failed got %q, wanted %q", got, want) + } +} + +func TestGetDomainName(t *testing.T) { + authorizer_url := "http://test.herokuapp.com" + + got := GetDomainName(authorizer_url) + want := "herokuapp.com" + + if got != want { + t.Errorf("GetHostName Test failed got %q, wanted %q", got, want) + } +}