feat(champ siret): improve default base SIRET column wording

This commit is contained in:
Colin Darie 2024-11-20 16:36:25 +01:00
parent b71d60dff9
commit 985cf32752
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
2 changed files with 16 additions and 1 deletions

View file

@ -116,7 +116,12 @@ class TypesDeChamp::TypeDeChampBase
private
def libelle_with_prefix(prefix)
[prefix, libelle].compact.join(' ')
# SIRET needs to be explicit in listings for better UI readability
if type_champ == "siret" && !libelle.upcase.include?("SIRET")
[prefix, libelle, "SIRET"].compact.join(' ')
else
[prefix, libelle].compact.join(' ')
end
end
def paths

View file

@ -7,6 +7,16 @@ describe TypesDeChamp::SiretTypeDeChamp do
describe "#columns" do
subject(:columns) { tdc_siret.columns(procedure: procedure) }
it "returns base column without duplicating SIRET when already in libelle" do
expect(columns[0].label).to eq("Numéro SIRET")
end
it "returns base column with SIRET when libelle doesn't contain SIRET" do
tdc_siret.update(libelle: "Identification de l'entreprise")
expect(columns[0].label).to eq("Identification de l'entreprise SIRET")
end
it "includes required jsonpaths" do
expected_paths = [
"$.entreprise_raison_sociale",