Slug: Combine various slugify fixes for special character handling (#73164)

* combine various slugify fixes for special character handling

* a couple more test cases

* update more tests

* goimports
This commit is contained in:
Dan Cech
2023-08-10 16:12:50 -04:00
committed by GitHub
parent 3bc3c4f2bb
commit dd97038b00
4 changed files with 40 additions and 14 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ func TestSaveExternalServiceRoleCommand_Validate(t *testing.T) {
Permissions: []Permission{{Action: "users:read", Scope: "users:id:1"}},
},
wantErr: false,
wantID: "thisis-a-very-strange-___-app-name",
wantID: "thisis-a-very-strange-app-name",
},
{
name: "invalid empty Action",
+3 -3
View File
@@ -77,9 +77,9 @@ func TestSlugifyTitle(t *testing.T) {
testCases := map[string]string{
"Grafana Play Home": "grafana-play-home",
"snöräv-över-ån": "snorav-over-an",
"漢字": "%e6%bc%a2%e5%ad%97", // "han-zi", // Hanzi for hanzi
"🇦🇶": "%f0%9f%87%a6%f0%9f%87%b6", // flag of Antarctica-emoji, using fallback
"𒆠": "%f0%92%86%a0", // cuneiform Ki, using fallback
"漢字": "e6bca2-e5ad97", // "han-zi", // Hanzi for hanzi
"🇦🇶": "f09f87a6-f09f87b6", // flag of Antarctica-emoji, using fallback
"𒆠": "f09286a0", // cuneiform Ki, using fallback
}
for input, expected := range testCases {