Skip to content

Commit

Permalink
Merge pull request #76 from DiogoAndreBotas/add-tests-for-download-nf…
Browse files Browse the repository at this point in the history
…c-face-endpoint

Add tests for Download NFC Face endpoint
  • Loading branch information
dvacca-onfido authored Feb 19, 2025
2 parents 4e2bbbf + c89d283 commit cb3fad7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 14 additions & 2 deletions spec/integrations/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,25 @@
end

it 'cannot download an inexistent document' do
inexistent_document_id = '00000000-0000-0000-0000-000000000000'

expect {
onfido_api.download_document(inexistent_document_id)
}.to raise_error(Onfido::ApiError) { |e|
expect(e.code).to eq(404)
}
end

it 'downloads an NFC face' do
file = onfido_api.download_nfc_face(nfc_face_id)

expect(file.size).to be > 0
end

it 'cannot download an inexistent NFC face' do
expect {
onfido_api.download_nfc_face(inexistent_document_id)
}.to raise_error(Onfido::ApiError) { |e|
expect(e.code).to eq(404)
}
end
end
end
4 changes: 4 additions & 0 deletions spec/shared_contexts/with_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@

let(:document) { onfido_api.upload_document(Onfido::DocumentTypes::PASSPORT, applicant_id, document_file) }
let!(:document_id) { document.id }

let(:nfc_face_id) { 'cc2dc25f-2df6-4f8f-a5aa-60f49cef9b3c' }

let(:inexistent_document_id) { '00000000-0000-0000-0000-000000000000' }
end

0 comments on commit cb3fad7

Please sign in to comment.