-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API-41802-empty-unit-test #19305
API-41802-empty-unit-test #19305
Changes from 5 commits
99f4d08
44b90e8
5fa8bb8
0b4c76a
552d64c
6facb01
cfa7147
7b2bf04
6222d55
3d8fac0
c947b85
73ba8b2
9d5f028
f959784
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ def validate_form_526_submission_values! | |
validate_service_after_13th_birthday! | ||
# ensure 'militaryRetiredPay.receiving' and 'militaryRetiredPay.willReceiveInFuture' are not same non-null values | ||
validate_form_526_service_pay! | ||
# ensure an error is avoided if the unit name is not provided | ||
transform_form_526_unit_name! | ||
# ensure 'title10ActivationDate' if provided, is after the earliest servicePeriod.activeDutyBeginDate and on or before the current date # rubocop:disable Layout/LineLength | ||
validate_form_526_title10_activation_date! | ||
# ensure 'title10Activation.anticipatedSeparationDate' is in the future | ||
|
@@ -140,6 +142,15 @@ def validate_form_526_title10_anticipated_separation_date! | |
) | ||
end | ||
|
||
def transform_form_526_unit_name! | ||
reserves = form_attributes&.dig('serviceInformation', 'reservesNationalGuardService') | ||
return if reserves.nil? | ||
|
||
unit_name = reserves['unitName'] | ||
unit_name = unit_name.presence || ' ' | ||
reserves['unit_name'] = unit_name | ||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stiehlrod Apologies for being so late to the party here, trying to get to these, This is a transform basically just for the docker container I believe. Wondering if this would be better off in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You would also then be able to test the returns in |
||
def validate_form_526_submission_claim_date! | ||
return if form_attributes['claimDate'].blank? | ||
return if DateTime.parse(form_attributes['claimDate']) <= Time.zone.now | ||
|
stiehlrod marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -872,6 +872,60 @@ | |||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
context "when 'unitName' is empty" do | ||||||
let(:unit_name) { '' } | ||||||
|
||||||
it 'returns a successful response' do | ||||||
stiehlrod marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
mock_acg(scopes) do |auth_header| | ||||||
VCR.use_cassette('claims_api/bgs/claims/claims') do | ||||||
VCR.use_cassette('claims_api/brd/countries') do | ||||||
par = json_data | ||||||
par['data']['attributes']['serviceInformation']['reservesNationalGuardService']['unitName'] = | ||||||
unit_name | ||||||
|
||||||
post path, params: par.to_json, headers: headers.merge(auth_header) | ||||||
expect(response).to have_http_status(:ok) | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
context "when 'unitName' is nil" do | ||||||
let(:unit_name) { nil } | ||||||
|
||||||
it 'returns a successful response' do | ||||||
mock_acg(scopes) do |auth_header| | ||||||
VCR.use_cassette('claims_api/bgs/claims/claims') do | ||||||
VCR.use_cassette('claims_api/brd/countries') do | ||||||
par = json_data | ||||||
par['data']['attributes']['serviceInformation']['reservesNationalGuardService']['unitName'] = | ||||||
unit_name | ||||||
|
||||||
post path, params: par.to_json, headers: headers.merge(auth_header) | ||||||
expect(response).to have_http_status(:unprocessable_entity) | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
context "when 'unitName' is not present" do | ||||||
it 'returns a successful response' do | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
mock_acg(scopes) do |auth_header| | ||||||
VCR.use_cassette('claims_api/bgs/claims/claims') do | ||||||
VCR.use_cassette('claims_api/brd/countries') do | ||||||
par = json_data | ||||||
par['data']['attributes']['serviceInformation']['reservesNationalGuardService'].delete('unitName') | ||||||
|
||||||
post path, params: par.to_json, headers: headers.merge(auth_header) | ||||||
expect(response).to have_http_status(:unprocessable_entity) | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.