From 4f17bc1b14f15594d7fd23f9d6e4baaed57b35ce Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Sat, 21 Nov 2020 17:53:18 -0500 Subject: [PATCH] Improve test coverage --- config/web_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/web_test.go b/config/web_test.go index d9d22be5..fa61a3b3 100644 --- a/config/web_test.go +++ b/config/web_test.go @@ -15,6 +15,19 @@ func TestWebConfig_SocketAddress(t *testing.T) { } } +func TestWebConfig_PrependWithContextRoot(t *testing.T) { + web := &webConfig{ContextRoot: "/status/"} + if result := web.PrependWithContextRoot("/api/v1/results"); result != "/status/api/v1/results/" { + t.Errorf("expected %s, got %s", "/status/api/v1/results/", result) + } + if result := web.PrependWithContextRoot("/health"); result != "/status/health/" { + t.Errorf("expected %s, got %s", "/status/health/", result) + } + if result := web.PrependWithContextRoot("/health/"); result != "/status/health/" { + t.Errorf("expected %s, got %s", "/status/health/", result) + } +} + // validContextRootTest specifies all test case which should end up in // a valid context root used to bind the web interface to var validContextRootTests = []struct {