Browse Source

add specs

pull/833/head
Dushan Despotovic 3 years ago
parent
commit
1b376e885e
  1. 11
      spec/components/check_answers_summary_list_card_component_spec.rb
  2. 14
      spec/fixtures/forms/2021_2022.json

11
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

14
spec/fixtures/forms/2021_2022.json vendored

@ -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",

Loading…
Cancel
Save