Skip to content

Commit

Permalink
Updated some code and removed debuggers
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshingYou1 committed Jan 17, 2025
1 parent 883f664 commit 983749f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 44 deletions.
28 changes: 7 additions & 21 deletions lib/hca/enrollment_eligibility/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,11 @@ def get_ezr_data(icn)
dependents = parse_dependents(response)
spouse = parse_spouse(response)

debugger

OpenStruct.new(
income.merge(
convert_insurance_hash(response, providers)
).merge(
dependents.present? ? { dependents: } : {}
).merge(spouse)
)
income.merge!(
convert_insurance_hash(response, providers)
).merge!(
dependents.present? ? { dependents: } : {}
).merge!(spouse)
end

# rubocop:disable Metrics/MethodLength
Expand Down Expand Up @@ -139,15 +135,11 @@ def get_marital_status(response)
end

def get_income(response, xpath)
debugger

income = {}

response.locate(xpath)&.each do |i|
income_type = i.nodes.select { |node| node.value == 'type' }.first&.nodes&.first
income_amount = i.nodes.select { |node| node.value == 'amount' }.first[0]&.nodes&.first

debugger
income_amount = i.nodes.select { |node| node.value == 'amount' }.first&.nodes&.first

case income_type
when 'Total Employment Income'
Expand All @@ -159,15 +151,13 @@ def get_income(response, xpath)
end
end

debugger

income
end

def parse_income(response)
income_xpath = "#{XPATH_PREFIX}financialsInfo/financialStatement/"

testing = Common::HashHelpers.deep_compact(
Common::HashHelpers.deep_compact(
{
veteranIncome: get_income(
response,
Expand All @@ -179,10 +169,6 @@ def parse_income(response)
)
}
)

debugger

testing
end


Check failure on line 174 in lib/hca/enrollment_eligibility/service.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/EmptyLines: Extra blank line detected.
Expand Down
2 changes: 0 additions & 2 deletions spec/lib/hca/enrollment_eligibility/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
VCR.use_cassette('example1', :record => :once) do

Check failure on line 41 in spec/lib/hca/enrollment_eligibility/service_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
ezr_data = described_class.new.get_ezr_data('1012830022V956566')

debugger

expect(ezr_data).to be_a(Object)
end
end
Expand Down
40 changes: 19 additions & 21 deletions spec/requests/v0/form1010_ezrs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,23 @@
end
end

describe 'GET veteran_prefill_data' do
context 'while authenticated', :skip_mvi do
let(:current_user) { build(:evss_user, :loa3, icn: '1012830022V956566') }

before do
sign_in_as(current_user)
end

context 'when no error occurs' do
it 'renders a successful JSON response' do
VCR.use_cassette('example_1', :record => :once) do
get(veteran_prefill_data_v0_form1010_ezrs_path)

debugger

expect(response.body.present?).to be(true)
end
end
end
end
end
# describe 'GET veteran_prefill_data' do
# context 'while authenticated', :skip_mvi do
# let(:current_user) { build(:evss_user, :loa3, icn: '1012830022V956566') }
#
# before do
# sign_in_as(current_user)
# end
#
# context 'when no error occurs' do
# it 'renders a successful JSON response' do
# VCR.use_cassette('example_1', :record => :once) do
# get(veteran_prefill_data_v0_form1010_ezrs_path)
#
# expect(response.body.present?).to be(true)
# end
# end
# end
# end
# end
end

0 comments on commit 983749f

Please sign in to comment.