Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/presenters/idv/in_person/ready_to_verify_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def needs_proof_of_address?
attr_reader :enrollment

def due_date
enrollment.created_at + IdentityConfig.store.in_person_enrollment_validity_in_days.days
start_date = enrollment.enrollment_established_at.presence || enrollment.created_at
start_date + IdentityConfig.store.in_person_enrollment_validity_in_days.days
end

def localized_hours(hours)
Expand Down
14 changes: 12 additions & 2 deletions spec/presenters/idv/in_person/ready_to_verify_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
let(:enrollment_code) { '2048702198804358' }
let(:current_address_matches_id) { true }
let(:created_at) { described_class::USPS_SERVER_TIMEZONE.parse('2022-07-14T00:00:00Z') }
let(:enrollment_established_at) do
described_class::USPS_SERVER_TIMEZONE.parse('2022-08-14T00:00:00Z')
end
let(:enrollment_selected_location_details) do
JSON.parse(UspsInPersonProofing::Mock::Fixtures.enrollment_selected_location_details)
end
Expand All @@ -16,11 +19,11 @@
enrollment_code: enrollment_code,
unique_id: InPersonEnrollment.generate_unique_id,
created_at: created_at,
enrollment_established_at: enrollment_established_at,
current_address_matches_id: current_address_matches_id,
selected_location_details: enrollment_selected_location_details,
)
end

subject(:presenter) { described_class.new(enrollment: enrollment) }

describe '#formatted_due_date' do
Expand All @@ -31,7 +34,14 @@
end

it 'returns a formatted due date' do
expect(formatted_due_date).to eq 'August 12, 2022'
expect(formatted_due_date).to eq 'September 12, 2022'
end

context 'there is no enrollment_established_at' do
let(:enrollment_established_at) { nil }
it 'returns formatted due date when no enrollment_established_at' do
expect(formatted_due_date).to eq 'August 12, 2022'
end
end
end

Expand Down