From 1b376e885e853584e7c90f56710ec92d027b5735 Mon Sep 17 00:00:00 2001 From: Dushan Despotovic Date: Fri, 19 Aug 2022 16:27:14 +0100 Subject: [PATCH] add specs --- ...eck_answers_summary_list_card_component_spec.rb | 11 +++++++++++ spec/fixtures/forms/2021_2022.json | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/spec/components/check_answers_summary_list_card_component_spec.rb b/spec/components/check_answers_summary_list_card_component_spec.rb index f1e8d4ce8..741b4600a 100644 --- a/spec/components/check_answers_summary_list_card_component_spec.rb +++ b/spec/components/check_answers_summary_list_card_component_spec.rb @@ -12,5 +12,16 @@ RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do result = render_inline(described_class.new(questions:, case_log:, user:)) expect(result).to have_content(questions.first.answer_label(case_log)) end + + it "applicable questions doesn't return questions that are hidden in check answers" do + summary_list = described_class.new(questions:, case_log:, user:) + expect(summary_list.applicable_questions.map(&:id).include?("retirement_value_check")).to eq(false) + end + + it "has the correct answer label for a question" do + summary_list = described_class.new(questions:, case_log:, user:) + sex1_question = questions[2] + expect(summary_list.get_answer_label(sex1_question)).to eq("Female") + end end end diff --git a/spec/fixtures/forms/2021_2022.json b/spec/fixtures/forms/2021_2022.json index bcd212742..92b8b8e48 100644 --- a/spec/fixtures/forms/2021_2022.json +++ b/spec/fixtures/forms/2021_2022.json @@ -168,6 +168,20 @@ "step": 1, "width": 2 }, + "retirement_value_check": { + "check_answer_label": "Retirement age soft validation", + "hidden_in_check_answers": true, + "header": "Are you sure this person is retired?", + "type": "interruption_screen", + "answer_options": { + "0": { + "value": "Yes" + }, + "1": { + "value": "No" + } + } + }, "sex2": { "check_answers_card_number": 2, "check_answer_label": "Person 2’s gender identity",