feat: update validation logic
This commit is contained in:
parent
6ffc1f4ce4
commit
b0f1a3d1bd
|
@ -875,7 +875,7 @@ func (params *ListPlayersParams) Names() []string {
|
|||
}
|
||||
|
||||
const (
|
||||
playerNamesMinLength = 1
|
||||
playerNamesMinLength = 0
|
||||
playerNamesMaxLength = 100
|
||||
)
|
||||
|
||||
|
|
|
@ -674,21 +674,6 @@ func TestListPlayersParams_SetNames(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ERR: len(names) < 1",
|
||||
args: args{
|
||||
names: nil,
|
||||
},
|
||||
expectedErr: domain.ValidationError{
|
||||
Model: "ListPlayersParams",
|
||||
Field: "names",
|
||||
Err: domain.LenOutOfRangeError{
|
||||
Min: 1,
|
||||
Max: 100,
|
||||
Current: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ERR: len(names) > 100",
|
||||
args: args{
|
||||
|
@ -704,7 +689,7 @@ func TestListPlayersParams_SetNames(t *testing.T) {
|
|||
Model: "ListPlayersParams",
|
||||
Field: "names",
|
||||
Err: domain.LenOutOfRangeError{
|
||||
Min: 1,
|
||||
Min: 0,
|
||||
Max: 100,
|
||||
Current: 101,
|
||||
},
|
||||
|
|
|
@ -810,7 +810,7 @@ func (params *ListTribesParams) Tags() []string {
|
|||
}
|
||||
|
||||
const (
|
||||
tribeTagsMinLength = 1
|
||||
tribeTagsMinLength = 0
|
||||
tribeTagsMaxLength = 100
|
||||
)
|
||||
|
||||
|
|
|
@ -614,21 +614,6 @@ func TestListTribesParams_SetTags(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ERR: len(tags) < 1",
|
||||
args: args{
|
||||
tags: nil,
|
||||
},
|
||||
expectedErr: domain.ValidationError{
|
||||
Model: "ListTribesParams",
|
||||
Field: "tags",
|
||||
Err: domain.LenOutOfRangeError{
|
||||
Min: 1,
|
||||
Max: 100,
|
||||
Current: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ERR: len(tags) > 100",
|
||||
args: args{
|
||||
|
@ -644,7 +629,7 @@ func TestListTribesParams_SetTags(t *testing.T) {
|
|||
Model: "ListTribesParams",
|
||||
Field: "tags",
|
||||
Err: domain.LenOutOfRangeError{
|
||||
Min: 1,
|
||||
Min: 0,
|
||||
Max: 100,
|
||||
Current: 101,
|
||||
},
|
||||
|
|
|
@ -583,7 +583,7 @@ func TestListPlayers(t *testing.T) {
|
|||
// body
|
||||
body := decodeJSON[apimodel.ErrorResponse](t, resp.Body)
|
||||
domainErr := domain.LenOutOfRangeError{
|
||||
Min: 1,
|
||||
Min: 0,
|
||||
Max: 100,
|
||||
Current: len(req.URL.Query()["name"]),
|
||||
}
|
||||
|
|
|
@ -583,7 +583,7 @@ func TestListTribes(t *testing.T) {
|
|||
// body
|
||||
body := decodeJSON[apimodel.ErrorResponse](t, resp.Body)
|
||||
domainErr := domain.LenOutOfRangeError{
|
||||
Min: 1,
|
||||
Min: 0,
|
||||
Max: 100,
|
||||
Current: len(req.URL.Query()["tag"]),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue