fix(recherche): show notification indicator for instructeurs

This commit is contained in:
Colin Darie 2024-01-11 18:35:19 +01:00
parent 62bd2cc0d7
commit 8a83fd2ce0
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
4 changed files with 34 additions and 8 deletions

View file

@ -140,15 +140,26 @@ describe RechercheController, type: :controller do
describe 'by champs' do
let(:query) { 'district A' }
before { subject }
it { is_expected.to have_http_status(200) }
it 'returns the expected dossier' do
subject
expect(assigns(:projected_dossiers).count).to eq(1)
expect(assigns(:projected_dossiers).first.dossier_id).to eq(dossier.id)
end
context 'when dossier has notification' do
before do
instructeur.follow(dossier)
dossier.touch(:last_commentaire_updated_at)
end
it 'assigns notification' do
subject
expect(assigns(:notifications_dossier_ids)).to eq([dossier.id])
end
end
context 'as an expert' do
let(:user) { avis.experts_procedure.expert.user }
let(:query) { 'district' }
@ -156,6 +167,7 @@ describe RechercheController, type: :controller do
it { is_expected.to have_http_status(200) }
it 'returns only the dossier available to the expert' do
subject
expect(assigns(:projected_dossiers).count).to eq(1)
expect(assigns(:projected_dossiers).first.dossier_id).to eq(dossier_with_expert.id)
end