@@ -69,8 +69,8 @@ func TestTemplateDisplayNameValid(t *testing.T) {
69
69
t .Parallel ()
70
70
// Tests whether display names are valid.
71
71
testCases := []struct {
72
- Username string
73
- Valid bool
72
+ Name string
73
+ Valid bool
74
74
}{
75
75
{"" , true },
76
76
{"1" , true },
@@ -88,6 +88,10 @@ func TestTemplateDisplayNameValid(t *testing.T) {
88
88
{"abcdefghijklmnopqrst" , true },
89
89
{"abcdefghijklmnopqrstu" , true },
90
90
{"Wow Test" , true },
91
+ {"abcdefghijklmnopqrstu-" , true },
92
+ {"a1b2c3d4e5f6g7h8i9j0k-" , true },
93
+ {"BANANAS_wow" , true },
94
+ {"test--now" , true },
91
95
92
96
{" " , false },
93
97
{" a" , false },
@@ -100,23 +104,19 @@ func TestTemplateDisplayNameValid(t *testing.T) {
100
104
{"12 " , false },
101
105
{" a1" , false },
102
106
{"a1 " , false },
103
- {"-abcdefghijKLmnopqrstu" , false },
104
- {"abcdefghijklmnopqrstu-" , false },
105
107
{"-123456789012345678901" , false },
106
108
{"-a1b2c3d4e5f6g7h8i9j0k" , false },
107
- {"a1b2c3d4e5f6g7h8i9j0k-" , false },
108
- {"BANANAS_wow" , false },
109
- {"test--now" , false },
109
+ {"-abcdefghijKLmnopqrstu" , false },
110
110
111
111
{"123456789012345678901234567890123" , false },
112
112
{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" , false },
113
113
{"123456789012345678901234567890123123456789012345678901234567890123" , false },
114
114
}
115
115
for _ , testCase := range testCases {
116
116
testCase := testCase
117
- t .Run (testCase .Username , func (t * testing.T ) {
117
+ t .Run (testCase .Name , func (t * testing.T ) {
118
118
t .Parallel ()
119
- valid := httpapi .TemplateDisplayNameValid (testCase .Username )
119
+ valid := httpapi .TemplateDisplayNameValid (testCase .Name )
120
120
require .Equal (t , testCase .Valid , valid == nil )
121
121
})
122
122
}
0 commit comments