|
|
|
@ -5,7 +5,9 @@ RSpec.describe Form::Sales::Pages::HandoverDateCheck, type: :model do
|
|
|
|
|
|
|
|
|
|
let(:page_id) { "" } |
|
|
|
|
let(:page_definition) { nil } |
|
|
|
|
let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } |
|
|
|
|
|
|
|
|
|
context "when form start year is <= 2024" do |
|
|
|
|
let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2025_or_later?: false) } |
|
|
|
|
let(:subsection) { instance_double(Form::Subsection, form:) } |
|
|
|
|
|
|
|
|
|
it "has correct subsection" do |
|
|
|
@ -45,4 +47,24 @@ RSpec.describe Form::Sales::Pages::HandoverDateCheck, type: :model do
|
|
|
|
|
it "is has correct interruption_screen_question_ids" do |
|
|
|
|
expect(page.interruption_screen_question_ids).to eq(%w[hodate saledate]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when form start year is 2025" do |
|
|
|
|
let(:form) { instance_double(Form, start_date: Time.zone.local(2025, 4, 1), start_year_2025_or_later?: true) } |
|
|
|
|
let(:subsection) { instance_double(Form::Subsection, form:) } |
|
|
|
|
|
|
|
|
|
it "has the correct title_text" do |
|
|
|
|
expect(page.title_text).to eq({ |
|
|
|
|
"translation" => "forms.2025.sales.soft_validations.hodate_check.title_text", |
|
|
|
|
"arguments" => [], |
|
|
|
|
}) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct depends_on" do |
|
|
|
|
expect(page.depends_on).to eq([ |
|
|
|
|
{ "hodate_5_years_or_more_saledate?" => true, "saledate_check" => nil }, |
|
|
|
|
{ "hodate_5_years_or_more_saledate?" => true, "saledate_check" => 1 }, |
|
|
|
|
]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|