Merge pull request #9310 from demarches-simplifiees/feat-graphql-dossier-corrections

API graphql: expose les demandes de corrections
This commit is contained in:
Paul Chavard 2023-07-21 22:00:42 +00:00 committed by GitHub
commit 03da5725d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 210 additions and 57 deletions

View file

@ -972,6 +972,23 @@ describe API::V2::GraphqlController do
end
end
context 'with correction' do
let(:input) { super().merge(correction: :incorrect) }
it 'should create a correction' do
expect(gql_data).to eq(dossierEnvoyerMessage: {
message: {
body: "Bonjour"
},
errors: nil
})
expect(dossier).to be_pending_correction
expect(dossier.pending_correction).to be_dossier_incorrect
expect(dossier.pending_correction.commentaire.body).to eq("Bonjour")
end
end
context 'schema error' do
let(:input) do
{

View file

@ -503,13 +503,13 @@ describe Instructeurs::DossiersController, type: :controller do
describe '#pending_correction' do
let(:message) { 'do that' }
let(:justificatif) { nil }
let(:kind) { nil }
let(:reason) { nil }
subject do
post :pending_correction, params: {
procedure_id: procedure.id, dossier_id: dossier.id,
dossier: { motivation: message, justificatif_motivation: justificatif },
kind:
reason:
}, format: :turbo_stream
end
@ -535,7 +535,7 @@ describe Instructeurs::DossiersController, type: :controller do
expect(dossier.reload).to be_en_construction
expect(dossier).to be_pending_correction
expect(dossier.corrections.last).to be_correction
expect(dossier.corrections.last).to be_dossier_incorrect
end
it 'create a comment with text body' do
@ -544,10 +544,10 @@ describe Instructeurs::DossiersController, type: :controller do
end
context 'flagged as incomplete' do
let(:kind) { 'incomplete' }
let(:reason) { 'incomplete' }
it 'create a correction of incomplete kind' do
expect(dossier.corrections.last).to be_incomplete
it 'create a correction of incomplete reason' do
expect(dossier.corrections.last).to be_dossier_incomplete
end
end