LG-13577 Save Sponsor ID on new Enrollments#10859
Conversation
…lments (Internal) and on EIPP Enhanced Enrollments (Upcoming Features)
spec/services/usps_in_person_proofing/enrollment_helper_spec.rb
Outdated
Show resolved
Hide resolved
…77-Save-Sponsor-Id-On-New-Enrollments
| it 'sets enrollment status to pending and sets established at date and unique id' do | ||
| it <<~STR.squish do | ||
| sets enrollment status to pending, sponsor_id to usps_ipp_sponsor_id, | ||
| and sets established at date and unique id |
There was a problem hiding this comment.
What if to clean this up instead of having a multi-line description you break it out into multiple it blocks by wrapping this into a context. Maybe something like this?
context 'when the in person enrollment is not enhanced ipp' do
before do
subject.schedule_in_person_enrollment(user:, pii:, is_enhanced_ipp:)
end
it 'sets enrollment status to pending' do
expect(user.in_person_enrollments.first.status).to eq(InPersonEnrollment::STATUS_PENDING)
end
it 'sets sponsor_id to usps_ipp_sponsor_id' do
expect(user.in_person_enrollments.first.sponsor_id).to eq(usps_ipp_sponsor_id)
end
it 'sets established at date' do
expect(user.in_person_enrollments.first.enrollment_established_at).to_not be_nil
end
it 'sets unique id' do
expect(user.in_person_enrollments.first.unique_id).to_not be_nil
end
endThis does however slightly increases the speed of the tests by 0.25 seconds, but I do think it helps with readability.
There was a problem hiding this comment.
@shanechesnutt-ft this is good suggestion. I think I will keep the existing pattern and thus speed over readability. If others have strong opinions in preference over readability, we can rework at a later time. I appreciate your feedback though. 🙏
There was a problem hiding this comment.
I tend to agree with leaning towards the single test. I think the intent of each test is reflected well enough in the expect statements.
eileen-nava
left a comment
There was a problem hiding this comment.
Good work. Approved.
| enrollment_code = create_usps_enrollment(enrollment, pii, is_enhanced_ipp) | ||
| return unless enrollment_code | ||
|
|
||
| if is_enhanced_ipp |
| it 'saves sponsor_id on the enrollment to the usps_eipp_sponsor_id' do | ||
| subject.schedule_in_person_enrollment(user:, pii:, is_enhanced_ipp:) | ||
|
|
||
| expect(user.in_person_enrollments.first.sponsor_id).to eq(usps_eipp_sponsor_id) |
…77-Save-Sponsor-Id-On-New-Enrollments
…77-Save-Sponsor-Id-On-New-Enrollments
🎫 Ticket
LG-13577 Save Sponsor ID on new enrollments
🛠 Summary of changes
usps_ipp_sponsor_idto sponsor_id on in_person_enrollments for In Person Proofing Enrollmentsusps_eipp_sponsor_idto sponsor_id on in_person_enrollments for Enhanced In Person Proofing Enrollmentsis_enhanced_ipp📜 Testing Plan
Get set up
identity-oidc-sinatra, seteipp_allowedto true in .env. Start server.identity-idp, setusps_ipp_sponsor_idto '123' andusps_eipp_sponsor_idto '987' in config/application.yml. Start server.1. Confirm that sponsor_id on in_person_enrollments is getting set to
usps_ipp_sponsor_idfor In Person Enrollments:http://localhost:9292/and pick Biometric Comparisonverify/in_person/ready_to_verify), open a new terminal for identity-idp and open the rails console withrails ce1 = InPersonEnrollment.lastand hit enter to get your enrollment.e1.sponsor_idto get the sponsor id saved to that enrollment. Confirm it is the value you saved in step 2 forusps_ipp_sponsor_id(ie: 123)2. Confirm that sponsor_id on in_person_enrollments is getting set to
usps_eipp_sponsor_idfor Enhanced In Person Enrollments:http://localhost:9292/and pick Enhanced In-person Proofingverify/in_person/ready_to_verify), open a new terminal for identity-idp and open the rails console withrails ce2 = InPersonEnrollment.lastand hit enter to get your enrollment.e2.sponsor_idto get the sponsor id saved to that enrollment. Confirm it is the value you saved in step 2 forusps_eipp_sponsor_id(ie: 987)