Skip to content

Commit

Permalink
fix: flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSim committed Apr 15, 2024
1 parent d857ad1 commit 7035f82
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions spec/controllers/api/v2/graphql_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def format_type_champ(type_champ)

it "should be returned" do
expect(gql_errors).to eq(nil)
expect(gql_data).to eq(dossier: {
expect(gql_data[:dossier]).to include(
id: dossier.to_typed_id,
number: dossier.id,
state: 'en_construction',
Expand Down Expand Up @@ -503,27 +503,32 @@ def format_type_champ(type_champ)
civilite: 'M',
dateDeNaissance: '1991-11-01'
},
messages: dossier.commentaires.map do |commentaire|
{
body: commentaire.body,
attachment: {
filename: commentaire.piece_jointe.filename.to_s,
contentType: commentaire.piece_jointe.content_type,
checksum: commentaire.piece_jointe.checksum,
byteSize: commentaire.piece_jointe.byte_size
},
email: commentaire.email
}
end,
avis: [],
champs: dossier.champs_public.map do |champ|
{
id: champ.to_typed_id,
label: champ.libelle,
stringValue: champ.for_api_v2
}
end
})
avis: []
)

expected_champs = dossier.champs_public.map do |champ|
{
id: champ.to_typed_id,
label: champ.libelle,
stringValue: champ.for_api_v2
}
end
expect(gql_data[:dossier][:champs]).to match_array(expected_champs)

expected_messages = dossier.commentaires.map do |commentaire|
{
body: commentaire.body,
attachment: {
filename: commentaire.piece_jointe.filename.to_s,
contentType: commentaire.piece_jointe.content_type,
checksum: commentaire.piece_jointe.checksum,
byteSize: commentaire.piece_jointe.byte_size
},
email: commentaire.email
}
end
expect(gql_data[:dossier][:messages]).to match_array(expected_messages)

expect(gql_data[:dossier][:champs][0][:id]).to eq(dossier.champs_public[0].type_de_champ.to_typed_id)
end
end
Expand Down

0 comments on commit 7035f82

Please sign in to comment.