Skip to content

Commit

Permalink
[Graphql] Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Mar 5, 2020
1 parent 7e08ea9 commit dd1e699
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
26 changes: 13 additions & 13 deletions spec/requests/api/graphql/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
let(:create_mutation) do
<<-GRAPHQL
mutation {
createConsignmentSubmission(input: { state: REJECTED, clientMutationId: "2", artist_id: "andy", title: "soup", category: JEWELRY, minimum_price_dollars: 50000, currency: "GBP" }){
createConsignmentSubmission(input: { state: REJECTED, clientMutationId: "2", artistID: "andy", title: "soup", category: JEWELRY, minimumPriceDollars: 50000, currency: "GBP" }){
clientMutationId
consignment_submission {
consignmentSubmission {
id
title
category
Expand All @@ -34,7 +34,7 @@
<<-GRAPHQL
mutation {
createConsignmentSubmission(input: { title: "soup" }){
consignment_submission {
consignmentSubmission {
id
title
}
Expand Down Expand Up @@ -66,7 +66,7 @@
params: { query: create_mutation },
headers: { 'Authorization' => "Bearer #{user_token}" }
expect(response.status).to eq 200
body = JSON.parse(response.body)
body = JSON.parse(response.body) # byebug
expect(body['data']['createConsignmentSubmission']).to eq nil
expect(
body['errors'][0]['message']
Expand All @@ -90,32 +90,32 @@
expect(response.status).to eq 200
body = JSON.parse(response.body)
expect(
body['data']['createConsignmentSubmission']['consignment_submission'][
body['data']['createConsignmentSubmission']['consignmentSubmission'][
'id'
]
).not_to be_nil
expect(
body['data']['createConsignmentSubmission']['consignment_submission'][
body['data']['createConsignmentSubmission']['consignmentSubmission'][
'title'
]
).to eq 'soup'
expect(
body['data']['createConsignmentSubmission']['consignment_submission'][
body['data']['createConsignmentSubmission']['consignmentSubmission'][
'category'
]
).to eq 'JEWELRY'
expect(
body['data']['createConsignmentSubmission']['consignment_submission'][
body['data']['createConsignmentSubmission']['consignmentSubmission'][
'state'
]
).to eq 'REJECTED'
expect(
body['data']['createConsignmentSubmission']['consignment_submission'][
body['data']['createConsignmentSubmission']['consignmentSubmission'][
'minimum_price_dollars'
]
).to eq 50_000
expect(
body['data']['createConsignmentSubmission']['consignment_submission'][
body['data']['createConsignmentSubmission']['consignmentSubmission'][
'currency'
]
).to eq 'GBP'
Expand All @@ -135,9 +135,9 @@

create_asset = <<-GRAPHQL
mutation {
addAssetToConsignmentSubmission(input: { clientMutationId: "test", submission_id: #{
addAssetToConsignmentSubmission(input: { clientMutationId: "test", submissionID: #{
submission.id
}, gemini_token: "gemini-token-hash" }){
}, geminiToken: "gemini-token-hash" }){
clientMutationId
asset {
id
Expand All @@ -150,7 +150,7 @@
post '/api/graphql', params: { query: create_asset }, headers: headers
expect(response.status).to eq 200

body = JSON.parse(response.body)
body = JSON.parse(response.body) # byebug
expect(
body['data']['addAssetToConsignmentSubmission']['asset']['id']
).not_to be_nil
Expand Down
18 changes: 9 additions & 9 deletions spec/requests/api/graphql/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
mutation {
updateConsignmentSubmission(input: { state: DRAFT, category: JEWELRY, clientMutationId: "test", id: #{
submission.id
}, artist_id: "andy-warhol", title: "soup" }){
}, artistID: "andy-warhol", title: "soup" }){
clientMutationId
consignment_submission {
consignmentSubmission {
category
state
id
Expand All @@ -43,9 +43,9 @@
let(:update_mutation_random_id) do
<<-GRAPHQL
mutation {
updateConsignmentSubmission(input: { clientMutationId: "test", id: 999999, artist_id: "andy-warhol", title: "soup" }){
updateConsignmentSubmission(input: { clientMutationId: "test", id: 999999, artistID: "andy-warhol", title: "soup" }){
clientMutationId
consignment_submission {
consignmentSubmission {
id
artist_id
title
Expand Down Expand Up @@ -114,28 +114,28 @@
expect(response.status).to eq 200
body = JSON.parse(response.body)
expect(
body['data']['updateConsignmentSubmission']['consignment_submission'][
body['data']['updateConsignmentSubmission']['consignmentSubmission'][
'id'
]
.to_i
).to eq submission.id
expect(
body['data']['updateConsignmentSubmission']['consignment_submission'][
body['data']['updateConsignmentSubmission']['consignmentSubmission'][
'title'
]
).to eq 'soup'
expect(
body['data']['updateConsignmentSubmission']['consignment_submission'][
body['data']['updateConsignmentSubmission']['consignmentSubmission'][
'artist_id'
]
).to eq 'andy-warhol'
expect(
body['data']['updateConsignmentSubmission']['consignment_submission'][
body['data']['updateConsignmentSubmission']['consignmentSubmission'][
'category'
]
).to eq 'JEWELRY'
expect(
body['data']['updateConsignmentSubmission']['consignment_submission'][
body['data']['updateConsignmentSubmission']['consignmentSubmission'][
'state'
]
).to eq 'DRAFT'
Expand Down

0 comments on commit dd1e699

Please sign in to comment.