test(api): add a test to cover single (flat) attachment extension

This commit is contained in:
Colin Darie 2022-11-07 14:25:01 +01:00
parent 1138604748
commit e1270d5ffe

View file

@ -183,6 +183,16 @@ RSpec.describe Types::DossierType, type: :graphql do
}
end
describe 'dossier with motivation attachment' do
let(:dossier) { create(:dossier, :accepte, :with_motivation, :with_justificatif) }
let(:query) { DOSSIER_WITH_MOTIVATION_QUERY }
let(:variables) { { number: dossier.id } }
it {
expect(data[:dossier][:motivationAttachment][:url]).not_to be_nil
}
end
DOSSIER_QUERY = <<-GRAPHQL
query($number: Int!) {
dossier(number: $number) {
@ -219,6 +229,16 @@ RSpec.describe Types::DossierType, type: :graphql do
}
GRAPHQL
DOSSIER_WITH_MOTIVATION_QUERY = <<-GRAPHQL
query($number: Int!) {
dossier(number: $number) {
motivationAttachment {
url
}
}
}
GRAPHQL
DOSSIER_WITH_CHAMPS_QUERY = <<-GRAPHQL
query($number: Int!) {
dossier(number: $number) {