Skip to content
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

NJ 271 - fix when review screen displays health insurance section #5457

Merged
merged 5 commits into from
Jan 29, 2025

Conversation

jachan
Copy link
Contributor

@jachan jachan commented Jan 27, 2025

Link to pivotal/JIRA issue

Is PM acceptance required? (delete one)

  • Yes - don't merge until JIRA issue is accepted!

Reminder: merge main into this branch and get green tests before merging to main

What was done?

  • Update NJ Review screen to have the same logic as the controller, only displays if there are dependents

How to test?

  • Use Springsteen MFJ, navigate to review screen, ensure that "Dependents DO NOT have Health Insurance" section does not appear

Screenshots (for visual changes)

  • Before
image
  • After
image

Copy link

Heroku app: https://gyr-review-app-5457-2e40f7315ce3.herokuapp.com/
View logs: heroku logs --app gyr-review-app-5457 (optionally add --tail)

@@ -23,7 +23,7 @@
</section>
<% end %>

<% if current_intake.has_health_insurance_requirement_exception? || current_intake.eligibility_all_members_health_insurance_no? %>
<% if current_intake.dependents.any? && (current_intake.has_health_insurance_requirement_exception? || current_intake.eligibility_all_members_health_insurance_no?) %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the second conditional necessary? If they answered no to the health insurance eligibility question, they either will be offboarded (and so will never get to the review screen) or they meet an exception

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great catch -- it was in the previous code so not introduced here, but I suspect that if we took it out then tests would probably still pass and would be cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some digging, I think you're right! This second condition is redundant because anyone at this point would have been screened out if they answered yes and didn't have an exception. Truth table below to validate that the logic behaves identically:

current_intake.has_health_insurance_requirement_exception? || current_intake.eligibility_all_members_health_insurance_no?
Exception True, Insurance_no? True = conditional True
Exception False, Insurance_no? True - screened out
Exception True, Insurance_no? False = conditional True
Exception False, Insurance_no? False = conditional False

current_intake.has_health_insurance_requirement_exception?
Exception True, Insurance_no? True = conditional True
Exception False, Insurance_no? True - screened out
Exception True, Insurance_no? False = conditional True
Exception False, Insurance_no? False = conditional False


context 'when no dependents and gross income at threshold' do
it 'does not show the dependents without health insurance block' do
allow_any_instance_of(Efile::Nj::Nj1040Calculator).to receive(:calculate_line_29).and_return 20_000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is a test or app functionality but just highlighting that the income threshold is just one of the exceptions to health insurance eligibility (the other being claimed as dependents on another return) and it's 20k for some filing statuses, 10k for others

Copy link
Contributor

@mluedke2 mluedke2 Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point - instead of getting into this or that reason for eligibility, which is all tested elsewhere, the mock here can have something like:

allow_any_instance_of(StateFileNjIntake).to receive(:eligibility_all_members_health_insurance_no?).and_return(false)

it 'does not show the dependents without health insurance block' do
allow_any_instance_of(Efile::Nj::Nj1040Calculator).to receive(:calculate_line_29).and_return 20_000
get :edit
expect(response.body).not_to have_text "Dependents who DO NOT have health insurance"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pebble] - I think if we have this test, we should pair it with a test case for the opposite when we do expect the text

require "rails_helper"

RSpec.describe StateFile::Questions::NjReviewController do
let(:intake) { create :state_file_nj_intake, :df_data_minimal }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dust] - should we use one of the more realistic profiles here? and then use mocks below as needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a good point - happy to make a new import for springsteen that represents no dependents.

@@ -29,14 +29,6 @@
expect(described_class.show?(intake)).to eq true
end
end

context "and did not have a health insurance requirement exception, but all members did not have health insurance" do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test case would never happen as someone with no exceptions and who answered no to the eligibility question would be screened out.

if self.eligibility_all_members_health_insurance_no? && !self.has_health_insurance_requirement_exception?

trait :df_data_no_deps do
raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('nj_springsteen_mfj') }
raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('nj_springsteen_mfj') }
primary_birth_date { Date.new(1990, 1, 1) }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to add birth dates or EITC check fails when trying to check age of filer/spouse.

@@ -181,8 +173,6 @@
trait :df_data_no_deps do
raw_direct_file_data { StateFile::DirectFileApiResponseSampleService.new.read_xml('nj_springsteen_mfj') }
raw_direct_file_intake_data { StateFile::DirectFileApiResponseSampleService.new.read_json('nj_springsteen_mfj') }
primary_birth_date { Date.new(1990, 1, 1) }
spouse_birth_date { Date.new(1990, 1, 1) }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spouse birth date was not set because filing status was incorrectly set to single.

head_of_household: 4,
qualifying_widow: 5,
}[evaluator.filing_status.to_sym] || evaluator.filing_status
intake.direct_file_data.filing_status = numeric_status
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code would always override filing status to be single

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this issue to a separate ticket: https://github.com/newjersey/affordability-pm/issues/279. Going to revert the logic for now, and use a persona with filing_status single (nj_lucky_single) and no dependents for the test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making that follow-up ticket!

Copy link
Contributor

@jnf jnf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jachan jachan requested a review from mluedke2 January 29, 2025 15:04
Copy link
Contributor

@mluedke2 mluedke2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@jachan jachan merged commit a4dacde into main Jan 29, 2025
7 checks passed
@jachan jachan deleted the nj-271-health-insurance-review branch January 29, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants