Skip to content

Commit

Permalink
Clean up of unused code for previous flow logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ellohez committed Jan 13, 2025
1 parent c3676a7 commit 6b553cc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 56 deletions.
20 changes: 1 addition & 19 deletions app/flows/uk_benefits_abroad_flow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -653,21 +653,6 @@ def define
end
end

# TODO: Is this still needed (any benefits other than winter fuel?)
radio :you_or_partner_pay_contributions_to_the_country? do
option :yes
option :no

next_node do |response|
case response
when "yes"
outcome :wfp_not_eligible_outcome
when "no"
question :you_or_partner_get_a_means_tested_benefit_in_the_country?
end
end
end

radio :you_or_partner_get_a_means_tested_benefit_in_the_country? do
option :yes
option :no
Expand All @@ -682,7 +667,6 @@ def define
end
end

# TODO: Do we need to check this??
radio :is_british_or_irish? do
option :yes
option :no
Expand All @@ -694,7 +678,6 @@ def define
when "jsa"
outcome :jsa_ireland_outcome
when "winter_fuel_payment"
# outcome :wfp_ireland_outcome
question :born_before_23_September_1958?
when "esa"
outcome(calculator.going_abroad ? :esa_going_abroad_eea_outcome : :esa_already_abroad_eea_outcome)
Expand All @@ -714,7 +697,6 @@ def define
outcome :pension_going_abroad_outcome # A2 going_abroad
outcome :jsa_social_security_going_abroad_outcome # A6 going_abroad
outcome :jsa_not_entitled_outcome # A7 going_abroad and A5 already_abroad
outcome :wfp_not_eligible_outcome # A8 going_abroad and A6 already_abroad
outcome :maternity_benefits_maternity_allowance_outcome # A10 going_abroad and A8 already_abroad
outcome :maternity_benefits_social_security_going_abroad_outcome # A12 going_abroad
outcome :maternity_benefits_not_entitled_outcome # A13 going_abroad and A11 already_abroad
Expand Down Expand Up @@ -778,9 +760,9 @@ def define
outcome :jsa_eea_going_abroad_maybe_outcome
outcome :jsa_ireland_outcome

outcome :wfp_going_abroad_eea_maybe_outcome
outcome :wfp_ireland_outcome
outcome :wfp_maybe_outcome
outcome :wfp_not_eligible_outcome

outcome :db_going_abroad_ireland_outcome
end
Expand Down

This file was deleted.

This file was deleted.

36 changes: 12 additions & 24 deletions test/flows/uk_benefits_abroad_flow_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "test_helper"
require "support/flow_test_helper"

# noinspection RubyResolve
class UkBenefitsAbroadFlowTest < ActiveSupport::TestCase
include FlowTestHelper

Expand Down Expand Up @@ -63,20 +64,12 @@ class UkBenefitsAbroadFlowTest < ActiveSupport::TestCase
should "have a next node of which_country? for a '#{benefit}' response if going_abroad" do
assert_next_node :which_country?, for_response: benefit
end

# Repeat of above for an 'already_abroad' response
# TODO: Could this could be refactored to use contexts for the different responses?
should "have a next node of which_country? for a '#{benefit}' response if already_abroad" do
add_responses going_or_already_abroad?: "already_abroad"
assert_next_node :which_country?, for_response: benefit
end
end

should "have a next node of iidb_already_claiming? for an 'iidb' response" do
assert_next_node :iidb_already_claiming?, for_response: "iidb"
end

# TODO: Example - what is the response needed for ESA and already_abroad? This is only testing going_abroad.
should "have a next node of esa_how_long_abroad? for an 'esa' response" do
assert_next_node :esa_how_long_abroad?, for_response: "esa"
end
Expand Down Expand Up @@ -172,21 +165,16 @@ class UkBenefitsAbroadFlowTest < ActiveSupport::TestCase
add_responses which_benefit?: "winter_fuel_payment"
end

%w[going_abroad already_abroad].each do |location|
should "have next node of is_british_or_irish? for an 'ireland' response if #{location}" do
add_responses going_or_already_abroad?: location
assert_next_node :is_british_or_irish?, for_response: "ireland"
end
should "have next node of is_british_or_irish? for an 'ireland' response" do
assert_next_node :is_british_or_irish?, for_response: "ireland"
end

should "have a next node of worked_in_eea_or_switzerland? for any EEA country response except ireland if #{location}" do
add_responses going_or_already_abroad?: location
assert_next_node :worked_in_eea_or_switzerland?, for_response: "liechtenstein"
end
should "have a next node of worked_in_eea_or_switzerland? for any EEA country response except ireland" do
assert_next_node :worked_in_eea_or_switzerland?, for_response: "liechtenstein"
end

should "have a next node of wfp_not_eligible_outcome for any non-EEA country response if #{location}" do
add_responses going_or_already_abroad?: location
assert_next_node :wfp_not_eligible_outcome, for_response: "australia"
end
should "have a next node of wfp_not_eligible_outcome for any non-EEA country response" do
assert_next_node :wfp_not_eligible_outcome, for_response: "australia"
end
end

Expand Down Expand Up @@ -980,7 +968,7 @@ class UkBenefitsAbroadFlowTest < ActiveSupport::TestCase
assert_next_node :db_already_abroad_eea_outcome, for_response: "before_jan_2021"
end

# TODO: Should we cycle through the different benefits for the following tests?
# TODO: Do we need to cycle through the different benefits for the following tests?
should "have a next node of jsa_eea_going_abroad_maybe_outcome for a 'before_jan_2021' response if benefit is jsa" do
assert_next_node :jsa_eea_going_abroad_maybe_outcome, for_response: "before_jan_2021"
end
Expand Down Expand Up @@ -1040,7 +1028,7 @@ class UkBenefitsAbroadFlowTest < ActiveSupport::TestCase
end

context "winter_fuel_payment" do
should "have a next node of born_before_23_September_1958 for a 'before_jan_2021' response if benefit is winter_fuel_payment and going_abroad" do
should "have a next node of born_before_23_September_1958 for a 'before_jan_2021' response if benefit is winter_fuel_payment" do
add_responses which_benefit?: "winter_fuel_payment"
assert_next_node :born_before_23_September_1958?, for_response: "before_jan_2021"
end
Expand All @@ -1051,7 +1039,7 @@ class UkBenefitsAbroadFlowTest < ActiveSupport::TestCase
assert_next_node :jsa_not_entitled_outcome, for_response: response
end

should "have a next node of wfp_not_eligible_outcome for a '#{response}' response if benefit is winter_fuel_payment and going_abroad" do
should "have a next node of wfp_not_eligible_outcome for a '#{response}' response if benefit is winter_fuel_payment" do
add_responses which_benefit?: "winter_fuel_payment"
assert_next_node :wfp_not_eligible_outcome, for_response: response
end
Expand Down

0 comments on commit 6b553cc

Please sign in to comment.