Remove deprecated SOA code
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -154,8 +154,7 @@ func TestValidationErrors_Methods(t *testing.T) {
|
||||
first := errors.First()
|
||||
if first == nil {
|
||||
t.Fatal("expected first error")
|
||||
}
|
||||
if first.Field != "email" {
|
||||
} else if first.Field != "email" {
|
||||
t.Errorf("expected first field to be 'email', got '%s'", first.Field)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -40,8 +40,7 @@ func TestMinItems(t *testing.T) {
|
||||
err := MinItems(2)(&items)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
if err.Code != ErrorCodeOutOfRange {
|
||||
} else if err.Code != ErrorCodeOutOfRange {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeOutOfRange, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -85,8 +84,7 @@ func TestMaxItems(t *testing.T) {
|
||||
err := MaxItems(2)(&items)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
if err.Code != ErrorCodeOutOfRange {
|
||||
} else if err.Code != ErrorCodeOutOfRange {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeOutOfRange, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -114,8 +112,7 @@ func TestUniqueItems(t *testing.T) {
|
||||
err := UniqueItems()(&items)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
if err.Code != ErrorCodeInvalidFormat {
|
||||
} else if err.Code != ErrorCodeInvalidFormat {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeInvalidFormat, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -157,12 +154,13 @@ func TestUniqueItems(t *testing.T) {
|
||||
err := UniqueItems()(&items)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error for non-comparable type")
|
||||
}
|
||||
if err.Code != ErrorCodeInvalidFormat {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeInvalidFormat, err.Code)
|
||||
}
|
||||
if err.Message != "cannot validate uniqueness for non-comparable types" {
|
||||
t.Errorf("unexpected error message: %s", err.Message)
|
||||
} else {
|
||||
if err.Code != ErrorCodeInvalidFormat {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeInvalidFormat, err.Code)
|
||||
}
|
||||
if err.Message != "cannot validate uniqueness for non-comparable types" {
|
||||
t.Errorf("unexpected error message: %s", err.Message)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -171,8 +169,7 @@ func TestUniqueItems(t *testing.T) {
|
||||
err := UniqueItems()(&items)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error for non-comparable type")
|
||||
}
|
||||
if err.Code != ErrorCodeInvalidFormat {
|
||||
} else if err.Code != ErrorCodeInvalidFormat {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeInvalidFormat, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -185,8 +182,7 @@ func TestUniqueItems(t *testing.T) {
|
||||
err := UniqueItems()(&items)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error for non-comparable type")
|
||||
}
|
||||
if err.Code != ErrorCodeInvalidFormat {
|
||||
} else if err.Code != ErrorCodeInvalidFormat {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeInvalidFormat, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -212,8 +208,7 @@ func TestUniqueItems(t *testing.T) {
|
||||
err := UniqueItems()(&items)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error for duplicate comparable structs")
|
||||
}
|
||||
if err.Code != ErrorCodeInvalidFormat {
|
||||
} else if err.Code != ErrorCodeInvalidFormat {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeInvalidFormat, err.Code)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -103,8 +103,7 @@ func TestRequired(t *testing.T) {
|
||||
err := Required()(&str)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error")
|
||||
}
|
||||
if err.Code != ErrorCodeRequired {
|
||||
} else if err.Code != ErrorCodeRequired {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeRequired, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -193,8 +192,7 @@ func TestRequired(t *testing.T) {
|
||||
err := Required()(slice)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error for empty []string slice")
|
||||
}
|
||||
if err.Code != ErrorCodeRequired {
|
||||
} else if err.Code != ErrorCodeRequired {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeRequired, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -212,8 +210,7 @@ func TestRequired(t *testing.T) {
|
||||
err := Required()(slice)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error for empty []int slice")
|
||||
}
|
||||
if err.Code != ErrorCodeRequired {
|
||||
} else if err.Code != ErrorCodeRequired {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeRequired, err.Code)
|
||||
}
|
||||
})
|
||||
@@ -234,8 +231,7 @@ func TestRequired(t *testing.T) {
|
||||
err := Required()(slice)
|
||||
if err == nil {
|
||||
t.Fatal("expected validation error for empty custom type slice")
|
||||
}
|
||||
if err.Code != ErrorCodeRequired {
|
||||
} else if err.Code != ErrorCodeRequired {
|
||||
t.Errorf("expected error code %s, got %s", ErrorCodeRequired, err.Code)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user