mirror of
https://github.com/grafana/grafana.git
synced 2025-09-28 04:24:18 +08:00

Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
31 lines
520 B
Go
31 lines
520 B
Go
package live
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
)
|
|
|
|
func TestParseChannelIdentifier(t *testing.T) {
|
|
ident, err := ParseChannelIdentifier("aaa/bbb/ccc/ddd")
|
|
if err != nil {
|
|
t.FailNow()
|
|
}
|
|
|
|
ex := ChannelIdentifier{
|
|
Scope: "aaa",
|
|
Namespace: "bbb",
|
|
Path: "ccc/ddd",
|
|
}
|
|
|
|
if diff := cmp.Diff(ident, ex); diff != "" {
|
|
t.Fatalf("Result mismatch (-want +got):\n%s", diff)
|
|
}
|
|
|
|
// Check an invalid identifier
|
|
_, err = ParseChannelIdentifier("aaa/bbb")
|
|
if err == nil {
|
|
t.FailNow()
|
|
}
|
|
}
|