Skip to content

Commit

Permalink
Update tests (error message checks)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed Oct 23, 2023
1 parent 7a4ee30 commit 758e5af
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BookIntegrationSpec extends Specification implements GraphQLSpec {

then:
result.errors.size() == 1
result.errors[0].message == "Validation error of type FieldUndefined: Field 'bookList' in type 'Query' is undefined @ 'bookList'"
result.errors[0].message == "Validation error (FieldUndefined@[bookList]) : Field 'bookList' in type 'Query' is undefined"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PaymentIntegrationSpec extends Specification implements GraphQLSpec {

then:
result.errors.size() == 1
result.errors[0].message == "Validation error of type FieldUndefined: Field 'paymentCreate' in type 'Mutation' is undefined @ 'paymentCreate'"
result.errors[0].message == "Validation error (FieldUndefined@[paymentCreate]) : Field 'paymentCreate' in type 'Mutation' is undefined"
}

void "test creating a credit card payment"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec {
then:
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])')
obj.errors[0].message.endsWith("is missing required fields '[profile]'")

when: 'The profile is provided, but missing a required field'
resp = graphQL.graphql("""
Expand All @@ -63,7 +64,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec {
then:
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])')
obj.errors[0].message.endsWith("is missing required fields '[lastName]'")
}

void "test creating a user without an address"() {
Expand All @@ -88,7 +90,8 @@ class UserIntegrationSpec extends Specification implements GraphQLSpec {
then:
obj.data == null
obj.errors.size() == 1
obj.errors[0].message.startsWith('Validation error of type WrongType')
obj.errors[0].message.startsWith('Validation error (WrongType@[userCreate])')
obj.errors[0].message.endsWith("is missing required fields '[address]'")

when: 'The address is provided, but missing a required field'
resp = graphQL.graphql("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class UserRoleIntegrationSpec extends Specification implements GraphQLSpec {

then:
result.errors.size() == 1
result.errors[0].message == "Validation error of type FieldUndefined: Field 'userRoleUpdate' in type 'Mutation' is undefined @ 'userRoleUpdate'"
result.errors[0].message == "Validation error (FieldUndefined@[userRoleUpdate]) : Field 'userRoleUpdate' in type 'Mutation' is undefined"
}

void "test listing entities with a complex composite id"() {
Expand Down

0 comments on commit 758e5af

Please sign in to comment.