Add test coverage for FunctionPrefixTrimmingURLPathTransformer

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (VMware)
2018-08-24 10:40:51 +01:00
committed by Alex Ellis
parent 4367fc4e35
commit e551d12b65
2 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package handlers
import (
"net/http"
"testing"
)
func Test_Transform_DoesntTransformRootPath(t *testing.T) {
req, _ := http.NewRequest(http.MethodGet, "/", nil)
transformer := TransparentURLPathTransformer{}
want := req.URL.Path
got := transformer.Transform(req)
if want != got {
t.Errorf("want: %s, got: %s", want, got)
}
}
func Test_Transform_DoesntTransformAdditionalPath(t *testing.T) {
req, _ := http.NewRequest(http.MethodGet, "/employees/", nil)
transformer := TransparentURLPathTransformer{}
want := req.URL.Path
got := transformer.Transform(req)
if want != got {
t.Errorf("want: %s, got: %s", want, got)
}
}