add fix for nil values on numeroVoie and typeVoie
This commit is contained in:
parent
1173f1e459
commit
412a87e532
2 changed files with 14 additions and 6 deletions
|
@ -7,7 +7,7 @@ module Types
|
|||
end
|
||||
|
||||
field :siren, String, null: false
|
||||
field :capital_social, GraphQL::Types::BigInt, null: false
|
||||
field :capital_social, GraphQL::Types::BigInt, null: false, description: "capital social de l’entreprise. -1 si inconnu."
|
||||
field :numero_tva_intracommunautaire, String, null: false
|
||||
field :forme_juridique, String, null: false
|
||||
field :forme_juridique_code, String, null: false
|
||||
|
@ -48,7 +48,8 @@ module Types
|
|||
end
|
||||
|
||||
def code_effectif_entreprise
|
||||
object.code_effectif_entreprise || ''
|
||||
# we need this in order to bypass Hashie::Dash deserialization issue on nil values
|
||||
object.code_effectif_entreprise
|
||||
end
|
||||
|
||||
def effectif_annuel
|
||||
|
@ -86,8 +87,8 @@ module Types
|
|||
field :naf, String, null: false
|
||||
field :libelle_naf, String, null: false
|
||||
field :adresse, String, null: false
|
||||
field :numero_voie, String, null: false
|
||||
field :type_voie, String, null: false
|
||||
field :numero_voie, String, null: true
|
||||
field :type_voie, String, null: true
|
||||
field :nom_voie, String, null: false
|
||||
field :complement_adresse, String, null: false
|
||||
field :code_postal, String, null: false
|
||||
|
|
|
@ -396,6 +396,8 @@ describe API::V2::GraphqlController do
|
|||
... on PersonneMorale {
|
||||
siret
|
||||
siegeSocial
|
||||
numeroVoie
|
||||
typeVoie
|
||||
entreprise {
|
||||
siren
|
||||
dateCreation
|
||||
|
@ -421,11 +423,13 @@ describe API::V2::GraphqlController do
|
|||
id: dossier.etablissement.to_typed_id,
|
||||
siret: dossier.etablissement.siret,
|
||||
siegeSocial: dossier.etablissement.siege_social,
|
||||
numeroVoie: dossier.etablissement.numero_voie.to_s,
|
||||
typeVoie: dossier.etablissement.type_voie.to_s,
|
||||
entreprise: {
|
||||
siren: dossier.etablissement.entreprise_siren,
|
||||
dateCreation: dossier.etablissement.entreprise_date_creation.iso8601,
|
||||
capitalSocial: dossier.etablissement.entreprise_capital_social.to_s,
|
||||
codeEffectifEntreprise: dossier.etablissement.entreprise_code_effectif_entreprise.to_s
|
||||
codeEffectifEntreprise: dossier.etablissement.entreprise_code_effectif_entreprise.to_s,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -434,7 +438,8 @@ describe API::V2::GraphqlController do
|
|||
|
||||
context "when there are missing data" do
|
||||
before do
|
||||
dossier.etablissement.update!(entreprise_code_effectif_entreprise: nil, entreprise_capital_social: nil)
|
||||
dossier.etablissement.update!(entreprise_code_effectif_entreprise: nil, entreprise_capital_social: nil,
|
||||
numero_voie: nil, type_voie: nil)
|
||||
end
|
||||
|
||||
it "should be returned" do
|
||||
|
@ -450,6 +455,8 @@ describe API::V2::GraphqlController do
|
|||
id: dossier.etablissement.to_typed_id,
|
||||
siret: dossier.etablissement.siret,
|
||||
siegeSocial: dossier.etablissement.siege_social,
|
||||
numeroVoie: nil,
|
||||
typeVoie: nil,
|
||||
entreprise: {
|
||||
siren: dossier.etablissement.entreprise_siren,
|
||||
dateCreation: dossier.etablissement.entreprise_date_creation.iso8601,
|
||||
|
|
Loading…
Reference in a new issue