Skip to content

Commit 70d2da2

Browse files
committed
Ensure ImmunisationImport calls Patient Updaters
We're about to make some changes in where `PatientTeamUpdater.call` and `PatientStatusUpdater.call` are called from `ImmunisationImport`. This adds some test coverage to make sure we don't accidentally stop calling them. Co-authored_by: Chris Lowis <chris.lowis@gofreerange.com>
1 parent 7067786 commit 70d2da2

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

spec/models/immunisation_import_spec.rb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,31 @@
524524
create(
525525
:immunisation_import,
526526
team:,
527-
vaccination_records: [vaccination_record]
527+
vaccination_records: [vaccination_record],
528+
patients: [create(:patient)]
528529
)
529530
end
530531
let(:session) { create(:session, location: school, programmes:) }
531532
let(:vaccination_record) do
532533
create(:vaccination_record, programme: programmes.first, session:)
533534
end
534535

536+
it "calls the PatientTeamUpdater with imported patients" do
537+
expect(PatientTeamUpdater).to receive(:call).with(
538+
patient_scope: immunisation_import.patients
539+
)
540+
541+
immunisation_import.send :post_commit!
542+
end
543+
544+
it "calls the PatientStatusUpdater with imported patients" do
545+
expect(PatientStatusUpdater).to receive(:call).with(
546+
patient_scope: Patient.where(id: immunisation_import.patients.ids)
547+
)
548+
549+
immunisation_import.send :post_commit!
550+
end
551+
535552
it "syncs the flu vaccination record to the NHS Immunisations API" do
536553
expect { immunisation_import.send :post_commit! }.to enqueue_sidekiq_job(
537554
SyncVaccinationRecordToNHSJob

0 commit comments

Comments
 (0)