From b7809918f0e38a02e7fbbc2c52efbe1153739472 Mon Sep 17 00:00:00 2001 From: Emil Tullstedt Date: Tue, 21 Apr 2020 11:31:10 +0200 Subject: [PATCH] Dashboard: Update tests for testing fallback support (#23730) --- pkg/models/dashboards_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/models/dashboards_test.go b/pkg/models/dashboards_test.go index 69bc8ab7bd9..39fd61a9e2c 100644 --- a/pkg/models/dashboards_test.go +++ b/pkg/models/dashboards_test.go @@ -29,10 +29,20 @@ func TestDashboardModel(t *testing.T) { So(dashboard.Slug, ShouldEqual, "grafana-play-home") }) - Convey("Can slugify title", t, func() { - slug := SlugifyTitle("Grafana Play Home") + Convey("Can slugify titles", t, func() { + tests := map[string]string{ + "Grafana Play Home": "grafana-play-home", + "snöräv-över-ån": "snorav-over-an", + "漢字": "han-zi", // Hanzi for hanzi + "🇦🇶": "8J-HpvCfh7Y", // flag of Antarctica-emoji, using fallback + "𒆠": "8JKGoA", // cuneiform Ki, using fallback + } - So(slug, ShouldEqual, "grafana-play-home") + for input, expected := range tests { + slug := SlugifyTitle(input) + + So(slug, ShouldEqual, expected) + } }) Convey("Given a dashboard json", t, func() {