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 189548098..76b5d24ff 100644 --- a/spec/components/check_answers_summary_list_card_component_spec.rb +++ b/spec/components/check_answers_summary_list_card_component_spec.rb @@ -1,6 +1,8 @@ require "rails_helper" RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do + include CollectionTimeHelper + subject(:component) { described_class.new(questions:, log:, user:) } let(:rendered) { render_inline(component) } @@ -64,4 +66,16 @@ RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do expect(rendered).to have_link(log.form.get_question("tenancycode", log).check_answer_prompt, href: "/lettings-logs/#{log.id}/tenant-code?referrer=check_answers_new_answer", class: "govuk-link govuk-link--no-visited-state") end end + + context "when a log is from an archived collection year" do + context "when given a set of questions" do + let(:log) { create(:lettings_log, :completed, :ignore_validation_errors, age2: 99, startdate: archived_collection_start_date, assigned_to: create(:user)) } + + it "renders a summary list card without question numbers for the answers to those questions" do + expect(rendered).to have_content(questions.first.answer_label(log)) + expect(rendered).to have_content("Lead tenant’s age") + expect(rendered).not_to include(" - Lead tenant’s age") + end + end + end end