(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestGetPath(t *testing.T) { |
| 26 | t.Run("without query", func(t *testing.T) { |
| 27 | // execute |
| 28 | got := GetPath("/some-path", nil) |
| 29 | |
| 30 | // test |
| 31 | assert.Equal(t, got, "/some-path", "got mismatch") |
| 32 | }) |
| 33 | |
| 34 | t.Run("with query", func(t *testing.T) { |
| 35 | // execute |
| 36 | q := url.Values{} |
| 37 | q.Set("foo", "bar") |
| 38 | q.Set("baz", "/quz") |
| 39 | got := GetPath("/some-path", &q) |
| 40 | |
| 41 | // test |
| 42 | assert.Equal(t, got, "/some-path?baz=%2Fquz&foo=bar", "got mismatch") |
| 43 | }) |
| 44 | } |