From f92bf9fc05b6f41da4977e82329d58ae5551de19 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Mon, 25 Sep 2023 11:37:51 -0700 Subject: [PATCH] using reflect.DeepEqual to compare the expected and actual QueryParams --- middleware_test.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/middleware_test.go b/middleware_test.go index 09c8dfc2..32d55974 100644 --- a/middleware_test.go +++ b/middleware_test.go @@ -268,23 +268,9 @@ func Test_parseRequestURL(t *testing.T) { if expectedURL.String() != actualURL.String() { t.Errorf("r.URL = %q does not match expected %q", r.URL, tt.expectedURL) } - if len(expectedQuery) != len(actualQuery) { + if !reflect.DeepEqual(expectedQuery, actualQuery) { t.Errorf("r.URL = %q does not match expected %q", r.URL, tt.expectedURL) } - for name, expected := range expectedQuery { - actual, ok := actualQuery[name] - if !ok { - t.Errorf("r.URL = %q does not match expected %q", r.URL, tt.expectedURL) - } - if len(expected) != len(actual) { - t.Errorf("r.URL = %q does not match expected %q", r.URL, tt.expectedURL) - } - for i, v := range expected { - if v != actual[i] { - t.Errorf("r.URL = %q does not match expected %q", r.URL, tt.expectedURL) - } - } - } }) } }