Merge pull request #7722 from betagouv/fix-entreprise-without-date-creation
fix(api_entreprise job): don't fail with an entreprise without date_creation
This commit is contained in:
commit
5268962797
2 changed files with 13 additions and 1 deletions
|
@ -10,7 +10,7 @@ class APIEntreprise::EntrepriseAdapter < APIEntreprise::Adapter
|
|||
params[:etat_administratif] = map_etat_administratif(data_source)
|
||||
|
||||
if params.present? && valid_params?(params)
|
||||
params[:date_creation] = Time.zone.at(params[:date_creation]).to_datetime
|
||||
params[:date_creation] = Time.zone.at(params[:date_creation]).to_datetime if params[:date_creation].present?
|
||||
params.transform_keys { |k| :"entreprise_#{k}" }
|
||||
else
|
||||
{}
|
||||
|
|
|
@ -72,6 +72,18 @@ describe APIEntreprise::EntrepriseAdapter do
|
|||
expect(subject[:entreprise_etat_administratif]).to eq('actif')
|
||||
end
|
||||
end
|
||||
|
||||
context "when date_creation is empty" do
|
||||
let(:body) do
|
||||
hash = JSON.parse(super())
|
||||
hash["entreprise"]["date_creation"] = nil
|
||||
JSON.generate(hash)
|
||||
end
|
||||
|
||||
it 'L\'entreprise ne contient pas de date_creation' do
|
||||
expect(subject[:entreprise_date_creation]).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when the SIRET is unknown" do
|
||||
|
|
Loading…
Reference in a new issue