Skip to content

Commit

Permalink
Add test for sample not found during clone service
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyThiessen committed Oct 18, 2024
1 parent 788cbf5 commit 84a6e03
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/services/samples/clone_service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ def setup
I18n.t('services.samples.clone.same_project'))
end

test 'not clone samples with not matching sample ids' do
clone_samples_params = { new_project_id: @new_project.id, sample_ids: ['gid://irida/Sample/not_a_real_id'] }
assert_empty Samples::CloneService.new(@project, @john_doe).execute(clone_samples_params[:new_project_id],
clone_samples_params[:sample_ids])
assert_equal(I18n.t('services.samples.clone.samples_not_found', sample_ids: 'gid://irida/Sample/not_a_real_id'),
@project.errors.messages_for(:samples).first)
end

test 'authorized to clone samples from source project' do
clone_samples_params = { new_project_id: @new_project.id, sample_ids: [@sample1.id, @sample2.id] }
Samples::CloneService.new(@project, @john_doe).execute(clone_samples_params[:new_project_id],
Expand Down

0 comments on commit 84a6e03

Please sign in to comment.