fix(carte): gracefully ignore invalid year and kind params

Empêche d'envoyer une date invalide à PG et polluer les logs.
This commit is contained in:
Colin Darie 2024-05-15 23:29:45 +02:00
parent 40e952e8d2
commit 3d52601155
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
5 changed files with 31 additions and 29 deletions

View file

@ -18,5 +18,13 @@ describe CarteController do
get :show, params: { map_filter: { year: 2020 } }
expect(subject.stats['75']).to eq({ nb_demarches: 1, nb_dossiers: 20 })
end
it 'gracefully ignore invalid params' do
get :show, params: { map_filter: { year: "not!" } }
expect(subject.stats['75']).to eq({ nb_demarches: 2, nb_dossiers: 50 })
get :show, params: { map_filter: { kind: "nimp" } }
expect(subject.stats['75']).to eq({ nb_demarches: 2, nb_dossiers: 50 })
end
end
end