Skip to content

Commit

Permalink
only broadcast other agencies conventions when its refersTo is of typ…
Browse files Browse the repository at this point in the history
…e pole-emploi
  • Loading branch information
celineung committed Dec 18, 2024
1 parent 9216283 commit 6c20369
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,15 @@ const getLinkedAgencies = async (
const shouldBroadcastToFranceTravail = ({
agency,
featureFlags,
refersToAgency: _, // TODO not used anymore, until France Travail is ready to accept those
refersToAgency,
}: {
agency: AgencyDto;
refersToAgency: AgencyDto | null;
featureFlags: FeatureFlags;
}): boolean => {
const isBroadcastToFranceTravailAllowedForKind = (agencyKind: AgencyKind) => {
if (agency.kind === agencyKind) return true;
// TODO: uncomment when France Travail is ready to accept those
// if (refersToAgency && refersToAgency.kind === agencyKind) return true;
if (refersToAgency && refersToAgency.kind === "pole-emploi") return true;
return false;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,8 @@ describe("Broadcasts events to France Travail", () => {
);
});

// TODO: uncomment when France Travail is ready to accept those
it.skip("broadcast to pole-emploi when convention is from an agency RefersTo", async () => {
it("broadcast to pole-emploi when convention is from an agency RefersTo", async () => {
// Prepare

const agencyWithRefersTo = toAgencyWithRights(
new AgencyDtoBuilder(peAgencyWithoutCounsellorsAndValidators)
.withId("635354435345435")
Expand Down Expand Up @@ -363,8 +361,7 @@ describe("Broadcasts events to France Travail", () => {
});
});

// TODO: uncomment when France Travail is ready to accept those
it.skip(`broadcast to france travail when convention is from an agency RefersTo (and the refered agency is ${agencyKind})`, async () => {
it(`do not broadcast to france travail when convention is from an agency RefersTo (and the refered agency is ${agencyKind})`, async () => {
uow.featureFlagRepository.featureFlags = featureFlag;

const agencyWithRefersTo = toAgencyWithRights(
Expand Down Expand Up @@ -397,12 +394,7 @@ describe("Broadcasts events to France Travail", () => {
});

// Assert
expect(poleEmploiGateWay.notifications).toHaveLength(1);
expectObjectsToMatch(poleEmploiGateWay.notifications[0], {
id: externalId,
originalId: conventionLinkedToAgencyReferingToOther.id,
statut: "DEMANDE_VALIDÉE",
});
expect(poleEmploiGateWay.notifications).toHaveLength(0);
});
},
);
Expand Down

0 comments on commit 6c20369

Please sign in to comment.