Sha256: 20a430fe40111ff9fe3738098a987fc2f5e9d285d168a38f23617fed9d4a60ec

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

require_relative '../shared_contexts/with_document'
require_relative '../shared_contexts/with_live_photo'

describe Onfido::Report do
  describe 'Report schemas' do
    include_context 'with document'
    include_context 'with live photo'

    it 'schema of Document report is valid' do
      document_report_id = onfido_api.create_check(
        Onfido::CheckBuilder.new(
          applicant_id: applicant_id,
          document_ids: [document_id],
          report_names: [Onfido::ReportName::DOCUMENT],
      )).report_ids[0]

      document_report = repeat_request_until_status_changes(
        Onfido::ReportStatus::COMPLETE
      ) { onfido_api.find_report(document_report_id) }

      expect(document_report).to be_an_instance_of Onfido::DocumentReport

      expect(document_report.name).to eq("document")
      expect(document_report.breakdown.data_comparison.breakdown.issuing_country.result).to eq("clear")
      expect(document_report.properties.date_of_birth).to eq(Date.parse("1990-01-01"))
    end

    it 'schema of Facial Similarity report is valid' do
      facial_similarity_report_id = onfido_api.create_check(
        Onfido::CheckBuilder.new(
          applicant_id: applicant_id,
          document_ids: [document_id],
          report_names: [Onfido::ReportName::FACIAL_SIMILARITY_PHOTO],
      )).report_ids[0]

      facial_similarity_report = repeat_request_until_status_changes(
        Onfido::ReportStatus::COMPLETE
      ) { onfido_api.find_report(facial_similarity_report_id) }

      expect(facial_similarity_report).to be_an_instance_of Onfido::FacialSimilarityPhotoReport
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
onfido-4.0.0 spec/integrations/report_schema_spec.rb
onfido-3.4.0 spec/integrations/report_schema_spec.rb
onfido-3.3.1 spec/integrations/report_schema_spec.rb
onfido-3.3.0 spec/integrations/report_schema_spec.rb
onfido-3.2.0 spec/integrations/report_schema_spec.rb
onfido-3.1.0 spec/integrations/report_schema_spec.rb
onfido-3.0.0 spec/integrations/report_schema_spec.rb