@@ -7,25 +7,29 @@ func TestValidateAdventurerNameQueryParam(t *testing.T) {
7
7
expectedName string
8
8
expectedOk bool
9
9
input []string
10
+ region string
10
11
}{
11
- {input : []string {"1Number" }, expectedName : "1Number" , expectedOk : true }, // Starts with a number
12
- {input : []string {"Adventurer_123" }, expectedName : "Adventurer_123" , expectedOk : true },
13
- {input : []string {"JohnDoe" }, expectedName : "JohnDoe" , expectedOk : true },
14
- {input : []string {"Name1" , "Name2" }, expectedName : "Name1" , expectedOk : true },
15
- {input : []string {"고대신" }, expectedName : "고대신" , expectedOk : true }, // Adventurer name with Korean characters
12
+ {input : []string {"1Number" }, region : "EU" , expectedName : "1Number" , expectedOk : true }, // Starts with a number
13
+ {input : []string {"Adventurer_123" }, region : "EU" , expectedName : "Adventurer_123" , expectedOk : true },
14
+ {input : []string {"JohnDoe" }, region : "EU" , expectedName : "JohnDoe" , expectedOk : true },
15
+ {input : []string {"Name1" , "Name2" }, region : "EU" , expectedName : "Name1" , expectedOk : true },
16
+ {input : []string {"고대신" }, region : "EU" , expectedName : "고대신" , expectedOk : true }, // Adventurer name with Korean characters
16
17
17
- {input : []string {"" }, expectedName : "" , expectedOk : false }, // Empty adventurer name
18
- {input : []string {"Ad" }, expectedName : "Ad" , expectedOk : false }, // Too short
19
- {input : []string {"Adventurer With Spaces" }, expectedName : "Adventurer With Spaces" , expectedOk : false }, // Contains spaces
20
- {input : []string {"AdventurerNameTooLong12345" }, expectedName : "AdventurerNameTooLong12345" , expectedOk : false }, // Too long
21
- {input : []string {"Name$" }, expectedName : "Name$" , expectedOk : false }, // Contains an invalid symbol
22
- {input : []string {}, expectedName : "" , expectedOk : false },
18
+ {input : []string {"" }, region : "EU" , expectedName : "" , expectedOk : false }, // Empty adventurer name
19
+ {input : []string {"Ad" }, region : "EU" , expectedName : "Ad" , expectedOk : false }, // Too short
20
+ {input : []string {"Adventurer With Spaces" }, region : "EU" , expectedName : "Adventurer With Spaces" , expectedOk : false }, // Contains spaces
21
+ {input : []string {"AdventurerNameTooLong12345" }, region : "EU" , expectedName : "AdventurerNameTooLong12345" , expectedOk : false }, // Too long
22
+ {input : []string {"Name$" }, region : "EU" , expectedName : "Name$" , expectedOk : false }, // Contains an invalid symbol
23
+ {input : []string {}, region : "EU" , expectedName : "" , expectedOk : false },
24
+
25
+ {input : []string {"" }, region : "SA" , expectedName : "" , expectedOk : false },
26
+ {input : []string {"Ad" }, region : "SA" , expectedName : "Ad" , expectedOk : true },
23
27
}
24
28
25
29
for _ , test := range tests {
26
- name , ok := ValidateAdventurerNameQueryParam (test .input )
30
+ name , ok := ValidateAdventurerNameQueryParam (test .input , test . region )
27
31
if name != test .expectedName || ok != test .expectedOk {
28
- t .Errorf ("Input: %v, Expected: %v %v, Got: %v %v" , test .input , test .expectedName , test .expectedOk , name , ok )
32
+ t .Errorf ("Input: %v %v , Expected: %v %v, Got: %v %v" , test .input , test . region , test .expectedName , test .expectedOk , name , ok )
29
33
}
30
34
}
31
35
}
0 commit comments