check for error message and type

This commit is contained in:
Ivo Gosemann 2024-01-05 15:04:33 +01:00
parent 10a6885da1
commit fd5353eb72
No known key found for this signature in database

View File

@ -1051,9 +1051,12 @@ func TestRestMappingErrors(t *testing.T) {
// ensure that requesting a resource we _know_ not to exist results in an expected *meta.NoKindMatchError
err := b.Do().IntoSingleItemImplied(&singleItemImplied).Visit(test.Handle)
if err != nil {
if !errors.Is(err, &meta.NoKindMatchError{}) {
if !strings.Contains(err.Error(), "server doesn't have a resource type \"foo\"") {
t.Fatalf("unexpected error: %v", err)
}
if !errors.Is(err, &meta.NoKindMatchError{}) {
t.Fatalf("unexpected error type: %v", err)
}
}
expectedErr := fmt.Errorf("expected error")