api(mutation.dossier_modifier_annotation_drop_down_list): add mutation to change drop_down_list annotations value
This commit is contained in:
parent
bf1a057ac3
commit
8e6c5d1567
6 changed files with 132 additions and 1 deletions
|
@ -1230,9 +1230,13 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
|
||||
describe 'dossierModifierAnnotation' do
|
||||
let(:procedure) { create(:procedure, :published, :for_individual, :with_service, :with_all_annotations, administrateurs: [admin]) }
|
||||
let(:procedure) do
|
||||
create(:procedure, :published, :for_individual, :with_service, administrateurs: [admin], types_de_champ_private:)
|
||||
end
|
||||
|
||||
describe 'text' do
|
||||
let(:types_de_champ_private) { [{ type: :text }] }
|
||||
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierModifierAnnotationText(input: {
|
||||
|
@ -1266,6 +1270,8 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
|
||||
describe 'checkbox' do
|
||||
let(:types_de_champ_private) { [{ type: :checkbox }] }
|
||||
|
||||
let(:value) { 'true' }
|
||||
|
||||
let(:query) do
|
||||
|
@ -1316,6 +1322,7 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
|
||||
describe 'yes_no' do
|
||||
let(:types_de_champ_private) { [{ type: :yes_no }] }
|
||||
let(:value) { 'true' }
|
||||
|
||||
let(:query) do
|
||||
|
@ -1366,6 +1373,8 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
|
||||
describe 'date' do
|
||||
let(:types_de_champ_private) { [{ type: :date }] }
|
||||
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierModifierAnnotationDate(input: {
|
||||
|
@ -1399,6 +1408,8 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
|
||||
describe 'datetime' do
|
||||
let(:types_de_champ_private) { [{ type: :datetime }] }
|
||||
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierModifierAnnotationDatetime(input: {
|
||||
|
@ -1431,7 +1442,44 @@ describe API::V2::GraphqlController do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'drop_down_list' do
|
||||
let(:drop_down_list_options) { ['bijour'] }
|
||||
let(:types_de_champ_private) { [{ type: :drop_down_list, options: drop_down_list_options }] }
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierModifierAnnotationDropDownList(input: {
|
||||
dossierId: \"#{dossier.to_typed_id}\",
|
||||
annotationId: \"#{dossier.champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_typed_id}\",
|
||||
instructeurId: \"#{instructeur.to_typed_id}\",
|
||||
value: \"#{value}\"
|
||||
}) {
|
||||
annotation {
|
||||
stringValue
|
||||
}
|
||||
errors {
|
||||
message
|
||||
}
|
||||
}
|
||||
}"
|
||||
end
|
||||
|
||||
context "success" do
|
||||
let(:value) { drop_down_list_options.first }
|
||||
it 'should be a success' do
|
||||
expect(gql_errors).to eq(nil)
|
||||
|
||||
expect(gql_data).to eq(dossierModifierAnnotationDropDownList: {
|
||||
annotation: {
|
||||
stringValue: dossier.reload.champs_private.find { |c| c.type_champ == 'drop_down_list' }.to_s
|
||||
},
|
||||
errors: nil
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'integer_number' do
|
||||
let(:types_de_champ_private) { [{ type: :integer_number }] }
|
||||
let(:query) do
|
||||
"mutation {
|
||||
dossierModifierAnnotationIntegerNumber(input: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue