diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-05-09 18:25:02 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2023-05-10 09:02:53 +0200 |
| commit | dfd5a9acc134f1ea849a49efee7dd7f50c836e75 (patch) | |
| tree | ac41d021e09d5b8ac2c70938d59432092415e798 /pkg/html/html_test.go | |
| parent | 1964022bd4ae3c35688b98f6a4db45076c7d002c (diff) | |
dashboard: support filtering over multiple labels
For each label, allow only one value to be specified.
At the same time, allow multiple different labels (subsystem, origin,
prio, etc) be specified together.
Diffstat (limited to 'pkg/html/html_test.go')
| -rw-r--r-- | pkg/html/html_test.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/pkg/html/html_test.go b/pkg/html/html_test.go new file mode 100644 index 000000000..d824e0246 --- /dev/null +++ b/pkg/html/html_test.go @@ -0,0 +1,49 @@ +// Copyright 2023 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package html + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestDropParam(t *testing.T) { + tests := []struct { + in string + key string + value string + out string + }{ + { + in: `/upstream?first=a&second=b`, + key: `first`, + value: ``, + out: `/upstream?second=b`, + }, + { + in: `/upstream?first=a&first=b&second=c`, + key: `second`, + value: ``, + out: `/upstream?first=a&first=b`, + }, + { + in: `/upstream?first=a&first=b&second=c`, + key: `first`, + value: ``, + out: `/upstream?second=c`, + }, + { + in: `/upstream?first=a&first=b&second=c`, + key: `first`, + value: `b`, + out: `/upstream?first=a&second=c`, + }, + } + + for _, test := range tests { + got := DropParam(test.in, test.key, test.value) + assert.Equal(t, test.out, got) + } +} |
