feat(dossier): add dossier id to prefill response (#8382)

This commit is contained in:
Sébastien Carceles 2023-01-06 14:46:27 +01:00 committed by GitHub
parent 88518fed49
commit 177dec2bdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 7 deletions

View file

@ -30,11 +30,14 @@ RSpec.describe API::Public::V1::DossiersController, type: :controller do
expect(Dossier.last.user).to eq(nil)
end
it "responds with the brouillon dossier path" do
it "responds with the brouillon dossier url and id" do
create_request
expect(JSON.parse(response.body)["dossier_url"]).to eq(
"http://test.host#{commencer_path(procedure.path, prefill_token: Dossier.last.prefill_token)}"
)
dossier = Dossier.last
dossier_url = "http://test.host#{commencer_path(procedure.path, prefill_token: dossier.prefill_token)}"
expect(JSON.parse(response.body)["dossier_url"]).to eq(dossier_url)
expect(JSON.parse(response.body)["dossier_id"]).to eq(dossier.to_typed_id)
expect(JSON.parse(response.body)["dossier_number"]).to eq(dossier.id)
end
context 'when prefill values are given' do