fix(procedure): error descriptor link for v2 attestation

This commit is contained in:
Colin Darie 2024-11-27 12:46:45 +01:00
parent e8a671e081
commit 4eeaba5e60
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
3 changed files with 8 additions and 5 deletions

View file

@ -43,7 +43,11 @@ class Procedure::ErrorsSummary < ApplicationComponent
tdc = error.options[:type_de_champ]
annotations_admin_procedure_path(@procedure, anchor: dom_id(tdc.stable_self, :editor_error))
when :attestation_template
edit_admin_procedure_attestation_template_path(@procedure)
if error.detail[:value].version == 1
edit_admin_procedure_attestation_template_path(@procedure)
else
edit_admin_procedure_attestation_template_v2_path(@procedure)
end
when :initiated_mail, :received_mail, :closed_mail, :refused_mail, :without_continuation_mail, :re_instructed_mail
klass = "Mails::#{error.attribute.to_s.classify}".constantize
edit_admin_procedure_mail_template_path(@procedure, klass.const_get(:SLUG))

View file

@ -76,8 +76,7 @@ module Administrateurs
types_de_champ: [],
revision_types_de_champ: { type_de_champ: { piece_justificative_template_attachment: :blob } }
},
attestation_template_v1: [],
attestation_templates_v2: [],
attestation_template: [],
initiated_mail: [],
received_mail: [],
closed_mail: [],

View file

@ -101,7 +101,7 @@ describe Procedure::ErrorsSummary, type: :component do
it 'render error nicely' do
expect(page).to have_selector("a", text: "Les règles dinéligibilité")
expect(page).to have_selector("a", text: "Le modèle dattestation")
expect(page).to have_selector("a[href*='v2']", text: "Le modèle dattestation")
expect(page).to have_selector("a", text: "Lemail de notification de passage de dossier en instruction")
expect(page).to have_text("n'est pas valide", count: 2)
end
@ -118,7 +118,7 @@ describe Procedure::ErrorsSummary, type: :component do
end
it 'render error nicely' do
expect(page).to have_selector("a", text: "Le modèle dattestation")
expect(page).to have_selector("a:not([href*='v2'])", text: "Le modèle dattestation")
expect(page).to have_text("n'est pas valide", count: 1)
end
end