[MM-36481] Fix emoji regex to support thumbsup (#17846)

Этот коммит содержится в:
Guillermo Vayá
2021-06-29 19:37:15 +02:00
коммит произвёл GitHub
родитель ec8aaec5ce
Коммит f8fc5190ee
5 изменённых файлов: 90 добавлений и 9 удалений

Просмотреть файл

@@ -476,6 +476,84 @@ func TestIsValidAlphaNumHyphenUnderscore(t *testing.T) {
}
}
func TestIsValidAlphaNumHyphenUnderscorePlus(t *testing.T) {
cases := []struct {
Input string
Result bool
}{
{
Input: "test",
Result: true,
},
{
Input: "test+name",
Result: true,
},
{
Input: "test+-name",
Result: true,
},
{
Input: "test_+name",
Result: true,
},
{
Input: "test++name",
Result: true,
},
{
Input: "test_-name",
Result: true,
},
{
Input: "-",
Result: true,
},
{
Input: "_",
Result: true,
},
{
Input: "+",
Result: true,
},
{
Input: "test+",
Result: true,
},
{
Input: "test++",
Result: true,
},
{
Input: "test--",
Result: true,
},
{
Input: "test__",
Result: true,
},
{
Input: ".",
Result: false,
},
{
Input: "test,",
Result: false,
},
{
Input: "test:name",
Result: false,
},
}
for _, tc := range cases {
actual := IsValidAlphaNumHyphenUnderscorePlus(tc.Input)
require.Equalf(t, actual, tc.Result, "case: '%v'\tshould returned: %#v", tc.Input, tc.Result)
}
}
func TestIsValidId(t *testing.T) {
cases := []struct {
Input string