Skip to content

Commit

Permalink
fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Jun 19, 2023
1 parent 6c24d60 commit b1d0013
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,10 @@ handleEndOfScriptNotification(
"update-establishments-from-insee-api",
config,
main,
({
numberOfEstablishmentsToUpdate,
establishmentWithNewData,
errors = {},
}) => {
const nSiretFailed = Object.keys(errors).length;
const errorsAsString = Object.keys(errors)
.map((siret) => `For siret ${siret} : ${errors[siret]} `)
.join("\n");

return [
({ numberOfEstablishmentsToUpdate, establishmentWithNewData }) =>
[
`Updating ${numberOfEstablishmentsToUpdate} establishments for Insee Api`,
`Of which ${establishmentWithNewData} had new data`,
...(nSiretFailed > 0 ? [`Errors were: ${errorsAsString}`] : []),
].join("\n");
},
].join("\n"),
logger,
);
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@ describe("Postgres implementation of immersion offer repository", () => {
nafDto: { code: "22222", nomenclature: "Naf nomenclature yolo" },
numberEmployeesRange: "3-5",
},
[siret3]: {},
};

await pgEstablishmentAggregateRepository.updateEstablishmentsWithInseeData(
Expand Down Expand Up @@ -1461,7 +1462,9 @@ describe("Postgres implementation of immersion offer repository", () => {

expectToEqual(
updatedEstablishment3!.establishment,
establishment3.establishment,
new EstablishmentEntityBuilder(establishment3.establishment)
.withLastInseeCheck(inseeCheckDate)
.build(),
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type Report = {
numberOfEstablishmentsToUpdate: number;
establishmentWithNewData: number;
callsToInseeApi: number;
errors?: Record<SiretDto, any>;
};

type BatchReport = {
Expand Down

0 comments on commit b1d0013

Please sign in to comment.