Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORRECTION] Publie sur le bus *après* la mise à jour du service #1903

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/depots/depotDonneesServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,9 @@ const creeDepot = (config = {}) => {
};

const ajouteRisqueGeneralAService = async (unService, risque) => {
await busEvenements.publie(
new EvenementRisqueServiceModifie({ service: unService })
);
return ajouteAItemsDuService('risquesGeneraux', unService.id, risque);
await ajouteAItemsDuService('risquesGeneraux', unService.id, risque);
const s = await p.lis.un(unService.id);
busEvenements.publie(new EvenementRisqueServiceModifie({ service: s }));
};

const serviceExiste = async (idUtilisateur, nomService, idServiceMisAJour) =>
Expand Down
3 changes: 2 additions & 1 deletion test/depots/depotDonneesServices.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ describe('Le dépôt de données des services', () => {
expect(risques.risquesGeneraux.item(0).id).to.equal('R1');
});

it("publie un événement de 'Risques service modifiés'", async () => {
it("publie un événement de 'Risques service modifiés' avec le service à jour", async () => {
const risque = new RisqueGeneral({ id: 'R1' });
await depot.ajouteRisqueGeneralAService(service, risque);

Expand All @@ -516,6 +516,7 @@ describe('Le dépôt de données des services', () => {
);
expect(evenement.service).not.to.be(undefined);
expect(evenement.service.id).to.be('S1');
expect(evenement.service.risques.risquesGeneraux.nombre()).to.equal(1);
});
});

Expand Down
Loading