From 6c8063260ae0fea6ea9776c85bc5c0b2189a56be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Burkard?= Date: Tue, 17 Dec 2024 16:49:01 +0100 Subject: [PATCH] fixes after review --- back/package.json | 2 +- ...hmentAggregateRepository.sql.integration.test.ts | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/back/package.json b/back/package.json index 9fc1c8b9ed..b86416b37c 100644 --- a/back/package.json +++ b/back/package.json @@ -122,4 +122,4 @@ "ts-prune": "^0.10.3", "typescript": "^5.6.2" } -} \ No newline at end of file +} diff --git a/back/src/domains/establishment/adapters/PgEstablishmentAggregateRepository.sql.integration.test.ts b/back/src/domains/establishment/adapters/PgEstablishmentAggregateRepository.sql.integration.test.ts index f4614d5466..054e05b9db 100644 --- a/back/src/domains/establishment/adapters/PgEstablishmentAggregateRepository.sql.integration.test.ts +++ b/back/src/domains/establishment/adapters/PgEstablishmentAggregateRepository.sql.integration.test.ts @@ -175,7 +175,6 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () }); it("deactivates establishments with 50+ unanswered discussions and no recent conventions", async () => { - // Create establishment that should be deactivated const establishment = new EstablishmentAggregateBuilder() .withEstablishmentSiret("12345678901234") .withMaxContactsPerMonth(10) @@ -189,7 +188,6 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () ]) .build(); - // Create 50 unanswered discussions const discussions = Array.from({ length: 50 }, (_, i) => new DiscussionBuilder() .withSiret(establishment.establishment.siret) @@ -210,7 +208,6 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () .build(), ); - // Insert test data await pgEstablishmentAggregateRepository.insertEstablishmentAggregate( establishment, ); @@ -218,14 +215,11 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () discussions.map((d) => pgDiscussionRepository.insert(d)), ); - // Run the deactivation query const updatedEstablishments = await deactivateUnresponsiveEstablishmentsQuery(db); - // Verify the count of updated establishments expectToEqual(updatedEstablishments.length, 1); - // Verify the establishment was deactivated using direct DB query const result = await db .selectFrom("establishments") .select(["max_contacts_per_month", "status", "status_updated_at"]) @@ -238,7 +232,6 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () }); it("does not deactivate establishments with recent conventions", async () => { - // Create establishment const establishment = new EstablishmentAggregateBuilder() .withEstablishmentSiret("12345678901234") .withMaxContactsPerMonth(10) @@ -252,7 +245,6 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () ]) .build(); - // Create agency and convention const agency = new AgencyDtoBuilder().build(); await pgAgencyRepository.insert(toAgencyWithRights(agency)); @@ -263,7 +255,6 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () .withDateStart(new Date().toISOString()) .build(); - // Create 50 unanswered discussions const discussions = Array.from({ length: 50 }, (_, i) => new DiscussionBuilder() .withSiret(establishment.establishment.siret) @@ -284,7 +275,6 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () .build(), ); - // Insert test data await pgEstablishmentAggregateRepository.insertEstablishmentAggregate( establishment, ); @@ -293,14 +283,11 @@ describe("SQL queries, independent from PgEstablishmentAggregateRepository", () discussions.map((d) => pgDiscussionRepository.insert(d)), ); - // Run the deactivation query const updatedEstablishments = await deactivateUnresponsiveEstablishmentsQuery(db); - // Verify no establishments were updated expectToEqual(updatedEstablishments.length, 0); - // Verify the establishment was not deactivated using direct DB query const result = await db .selectFrom("establishments") .select(["max_contacts_per_month", "status", "status_updated_at"])