From e1270d5ffed849ee3ee6a2023ac4fbbf679f860c Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 7 Nov 2022 14:25:01 +0100 Subject: [PATCH] test(api): add a test to cover single (flat) attachment extension --- spec/graphql/dossier_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/graphql/dossier_spec.rb b/spec/graphql/dossier_spec.rb index 2b51c09fd..d5f6f4a2e 100644 --- a/spec/graphql/dossier_spec.rb +++ b/spec/graphql/dossier_spec.rb @@ -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) {