Donner export des tests/feature à Gael

L'idée ici serait d'avoir de l'outillage pour la documentation automatique de nos features plus communément appelé usecase par les devs d'un point de vue architecture applicative.
L'objectif étant multiple:

Que fait l'application ? Voici la liste des features/usecase
Comment fonctionne une feature dans le détail ? Voici la liste des scénarios de validation de la feature
Je fais un parcours, quelles features existantes je peux utiliser, quelles sont les features nouvelles ? Voici la liste des features en actuelles
Comment avoir tout ça avec le moindre effort ? Tout ce qui est généré dans le rapport est rédigé par les devs dans le code. Si c'est mal expliqué alors on peut renommer les choses. (un peu comme les templates de mail)

Le manque qu'on aura avec ce genre d'outil > On a pas l'info sur les parcours mais par contre on peut utiliser ces rapport pour identifier nos features et ensuite documenter les parcours / entretenir un catalogue de feature d'IF.
En regardant la liste des reporters de la communauté jest j'ai testé jest-html-reporters.
Ca donne des rapports de ce type avec très peu d'effort avec l'exemple de rapport qui focus nos features (usecase) en utilisant nos commandes de test classique comme pnpm back test:unit.  Cliquez sur l'image si vous voulez du zoom

Est-ce que ça serait pas ça : https://discord.com/channels/864451835553513474/1297831742786371625

Les deux son très cool je trouve.

L'un pour savoir ce qu'on a déjà comme info en base -> ex est-ce que je peux renvoyer directement sur une conversation via son id et rappeler la date d'envoi des échanges quand je fais un parcours/maquette
L'autre pour se rappeler des use cases. Par ex : qui peut envoyer une demande de modification et à qui / quand la conv a quel statut ?
Par ex je susi souvent perdue sur ce genre de feature aui a bcp bougé quand je dois répondre au support ou a un usager.

Autre piste de rapport, utiliser un export markdown (exemple ci-dessous mais on peut en faire un maison pour mieux ranger)

My Dashboard

:clock10: Start time
:hourglass: Duration

12/11/2024, 9:58:13 PM
7.996 s

:white_check_mark: Passed
:x: Failed
:construction: Todo
:white_circle: Total

Test Suites
112
0
-
112

Tests
998
0
0
1002

src/adapters/primary/routers/apiKeyAuthRouter/createOpenApiV2.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.313 s

:white_check_mark: createOpenApiSpecV2 function to generate OpenAPI v2 spec

:white_check_mark: does not throw

src/config/bootstrap/appConfig.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.156 s

:white_check_mark: appConfig

:white_check_mark: quarantinedTopics

src/domains/agency/use-cases/AddAgency.unit.test.ts [link]
10 passed, 0 failed, 0 todo, done in 0.306 s

:white_check_mark: AddAgency use case

:white_check_mark: right paths

:white_check_mark: save the agency in repo, with the default admin mail and the status to be reviewed
:white_check_mark: do not create other users if they exist with same email but apply rights on new agency for them
:white_check_mark: sets an events to be dispatched with the added agency
:white_check_mark: uses default questionnaire url when none is provided
:white_check_mark: agengy with refers to should have validator emails from referral agency

:white_check_mark: wrong paths

:white_check_mark: Fails to add agency if address components are empty
:white_check_mark: Fails to add agency if geo components are 0,0
:white_check_mark: fails when refered agency is missing
:white_check_mark: fails to create if the has the same address and kind than an existing one
:white_check_mark: fails to create if agency siret is not valid

src/domains/agency/use-cases/ListAgenciesByFilter.unit.test.ts [link]
15 passed, 0 failed, 0 todo, done in 0.246 s

:white_check_mark: Query: List agencies by filter

:white_check_mark: No filters

:white_check_mark: List all agencies with active statuses

:white_check_mark: With Agency kind filter

:white_check_mark: List miniStageOnly agencies
:white_check_mark: List immersionPeOnly agencies
:white_check_mark: List miniStageExcluded agencies
:white_check_mark: List withoutRefersToAgency agencies
:white_check_mark: List agencies for given siret

:white_check_mark: With Agency department code filter

:white_check_mark: List agencies with department code 95
:white_check_mark: List agencies with department code 75
:white_check_mark: List agencies with department code 78

:white_check_mark: With Agency name

:white_check_mark: List agencies with name 'PE'
:white_check_mark: List agencies with name 'Agence'
:white_check_mark: List agencies with name 'TOTO'

:white_check_mark: With Agency status filter

:white_check_mark: List agencies with status 'closed'
:white_check_mark: List agencies with status 'toReview'
:white_check_mark: List agencies with all the statuses

src/domains/agency/use-cases/PrivateListAgencies.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.177 s

:white_check_mark: PrivateListAgencies use case

:white_check_mark: should return agencies needing review as id an name object

src/domains/agency/use-cases/RegisterAgencyToInclusionConnectUser.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.228 s

:white_check_mark: RegisterAgencyToInclusionConnectUser use case

:white_check_mark: Wrong path

:white_check_mark: fails if no Jwt Token provided
:white_check_mark: fails if user does not exist
:white_check_mark: fails if no agency exist
:white_check_mark: fails if user already has agency rights

:white_check_mark: When User and agencies exist

:white_check_mark: makes the link between user and provided agency id, and saves the corresponding event
:white_check_mark: makes the links with all the given agencies, and events has all relevant ids

src/domains/agency/use-cases/UpdateAgency.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.259 s

:white_check_mark: Update agency

:white_check_mark: Wrong path

:white_check_mark: throws Unauthorized if no current user
:white_check_mark: throws Forbidden if current user is not admin
:white_check_mark: Fails trying to update if no matching agency was found
:white_check_mark: Fails to update agency if address components are empty
:white_check_mark: Fails to update agency if geo components are 0,0

:white_check_mark: Updates agency without changes on user rights and create corresponding event

src/domains/agency/use-cases/UpdateAgencyReferringToUpdatedAgency.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.257 s

:white_check_mark: UpdateAgencyReferingToUpdatedAgency

:white_check_mark: throw error when agency not found
:white_check_mark: right paths

:white_check_mark: update agencies validator emails that refers to updated agency
:white_check_mark: Remove the validator from agencies that refers to when it's role change from validator to an other one
:white_check_mark: do nothing when there no related agencies that refers to updated agency

src/domains/agency/use-cases/UpdateAgencyStatus.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.629 s

:white_check_mark: Update agency status

:white_check_mark: right path

:white_check_mark: Updates an agency status in repository and publishes an event to notify if status becomes active
:white_check_mark: Updates an agency status in repository and publishes an event to notify if status becomes rejected

:white_check_mark: wrong paths

:white_check_mark: returns 401 if no jwt payload
:white_check_mark: returns Forbbiden if user is not admin
:white_check_mark: returns 404 if agency not found

src/domains/convention/use-cases/AddConvention.unit.test.ts [link]
9 passed, 0 failed, 0 todo, done in 0.342 s

:white_check_mark: Add Convention

:white_check_mark: saves valid conventions in the repository
:white_check_mark: also sends the discussionId in the event, if initialy provided to the use case
:white_check_mark: rejects conventions where the ID is already in use
:white_check_mark: Status validation

:white_check_mark: allows applications submitted as DRAFT
:white_check_mark: allows applications submitted as READY_TO_SIGN
:white_check_mark: rejects applications if the status is not DRAFT or READY_TO_SIGN

:white_check_mark: SIRET validation

:white_check_mark: rejects applications with SIRETs that don't correspond to active businesses
:white_check_mark: accepts applications with SIRETs that  correspond to active businesses
:white_check_mark: Throws errors when the SIRET endpoint throws erorrs

src/domains/convention/use-cases/AddValidatedConventionNps.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.202 s

:white_check_mark: AddValidatedConventionNps use case

:white_check_mark: saves the nps correctly

src/domains/convention/use-cases/broadcast/BroadcastConventionAgain.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.28 s

:white_check_mark: BroadcastConventionAgain

:white_check_mark: Wrong paths

:white_check_mark: throws Forbidden if user doesn't have enough rights on convention
:white_check_mark: throws notFound when convention is not found

:white_check_mark: Right paths

:white_check_mark: when there is no previous broadcast

:white_check_mark: trigger ConventionBroadcastAgain event with the whole convention in payload
:white_check_mark: trigger ConventionBroadcastAgain event with the whole convention in payload

:white_check_mark: when there is a previous broadcast

:white_check_mark: trigger ConventionBroadcastAgain event with the whole convention in payload
:white_check_mark: trigger ConventionBroadcastAgain event with the whole convention in payload
:white_check_mark: throws tooManyRequest when user request broadcast again before 4h since last broadcast

src/domains/convention/use-cases/broadcast/BroadcastToFranceTravailOnConventionUpdates.unit.test.ts [link]
12 passed, 0 failed, 0 todo, done in 0.332 s

:running: Broadcasts events to France Travail

:white_check_mark: Skips convention if not linked to an agency of kind pole-emploi nor agencyRefersTo of kind pole-emploi
:white_check_mark: Conventions without federated id are still sent, with their externalId
:white_check_mark: If Pe returns a 404 error, we store the error in a repo
:white_check_mark: store the broadcast feetback success in a repo
:white_check_mark: Converts and sends conventions, with externalId and federated id
:white_check_mark: if an axios error happens
:running: broadcast to pole-emploi when convention is from an agency RefersTo
:running: sends also other type of Convention when corresponding feature flag is activated

:running: when enable mission-locale feature flag is ACTIVE

:white_check_mark: broadcasts to france travail, even for convention linked to mission-locale
:running: broadcast to france travail when convention is from an agency RefersTo (and the refered agency is mission-locale)

:running: when enable conseil-departemental feature flag is ACTIVE

:white_check_mark: broadcasts to france travail, even for convention linked to conseil-departemental
:running: broadcast to france travail when convention is from an agency RefersTo (and the refered agency is conseil-departemental)

:running: when enable cap-emploi feature flag is ACTIVE

:white_check_mark: broadcasts to france travail, even for convention linked to cap-emploi
:running: broadcast to france travail when convention is from an agency RefersTo (and the refered agency is cap-emploi)

:white_check_mark: when mission-locale feature flag is OFF

:white_check_mark: does NOT broadcasts to france travail, for mission-locale

:white_check_mark: when conseil-departemental feature flag is OFF

:white_check_mark: does NOT broadcasts to france travail, for conseil-departemental

:white_check_mark: when cap-emploi feature flag is OFF

:white_check_mark: does NOT broadcasts to france travail, for cap-emploi

src/domains/convention/use-cases/ConventionsReminder.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.262 s

:white_check_mark: ConventionReminder use case

:white_check_mark: Do nothing

:white_check_mark: When there is no convention that have status different of READY_TO_SIGN, PARTIALLY_SIGNED or IN_REVIEW.
:white_check_mark: When there is conventions that is above 1 open day after internship starts

:white_check_mark: Send 'ConventionReminderRequired' event

:white_check_mark: When conventions exists, not fully signed which where submitted exactly 2 days before
:white_check_mark: with kind 'FirstReminderForSignatories'
when there is a convention that is not fully signed and was published exactly 2 days before
:white_check_mark: with kind 'LastReminderForSignatories'
when there is a convention that is below 2 open days before interships start depending of convention statuses.
:white_check_mark: with kind 'FirstReminderForAgency' and 'FirstReminderForSignatories'
when there is a convention that is between 3 and 2 open days before interships start depending of convention statuses.
:white_check_mark: with kind 'LastReminderForSignatories' and 'LastReminderForAgency'
when there is a convention that is below 1 open days before interships start depending on conventions statuses.

src/domains/convention/use-cases/CreateAssessment.unit.test.ts [link]
15 passed, 0 failed, 0 todo, done in 0.245 s

:white_check_mark: CreateAssessment

:white_check_mark: throws forbidden if no magicLink payload is provided
:white_check_mark: throws forbidden if magicLink payload has a different applicationId linked
:white_check_mark: throws forbidden if magicLink role is not establishment
:white_check_mark: throws not found if provided conventionId does not match any in DB
:white_check_mark: throws ConflictError if the assessment already exists for the Convention
:white_check_mark: throws bad request if the Convention status is READY_TO_SIGN
:white_check_mark: throws bad request if the Convention status is PARTIALLY_SIGNED
:white_check_mark: throws bad request if the Convention status is IN_REVIEW
:white_check_mark: throws bad request if the Convention status is REJECTED
:white_check_mark: throws bad request if the Convention status is CANCELLED
:white_check_mark: throws bad request if the Convention status is DEPRECATED
:white_check_mark: throws bad request if the Convention status is DRAFT
:white_check_mark: throws bad request if the Convention status is ACCEPTED_BY_COUNSELLOR
:white_check_mark: should save the Assessment if Convention has status ACCEPTED_BY_VALIDATOR
:white_check_mark: should dispatch an AssessmentCreated event

src/domains/convention/use-cases/GetAgencyPublicInfoById.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.696 s

:white_check_mark: GetAgencyPublicInfoById

:white_check_mark: Happy path

:white_check_mark: Should return agency public info for agency with referred agency
:white_check_mark: Should return agency public info for agency without referred agency

:white_check_mark: Wrong path

:white_check_mark: Should throw NotFoundError if agency does not exist
:white_check_mark: Should throw if referred agency doesn't exist

src/domains/convention/use-cases/GetApiConsumersByConvention.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.203 s

:white_check_mark: GetApiConsumersByConvention

:white_check_mark: Throw not found error if no convention were found
:white_check_mark: Throw not found error if no user were found
:white_check_mark: Throw not found error if no agency were found for convention
:white_check_mark: return empty array if user doesn't have enough rights on convention
:white_check_mark: return an array with France Travail if convention is of kind pole emploi and if user has right on the convention
:white_check_mark: return an array with the api partners names link to the convention if user has right on the convention
:white_check_mark: return an array with the api partners names link to the convention if user is admin

src/domains/convention/use-cases/GetConvention.unit.test.ts [link]
21 passed, 0 failed, 0 todo, done in 0.32 s

:white_check_mark: Get Convention

:white_check_mark: Wrong paths

:white_check_mark: Forbidden error

:white_check_mark: When no auth payload provided
:white_check_mark: When the user don't have correct role on inclusion connected users
:white_check_mark: with ConventionJwtPayload

:white_check_mark: When convention id in jwt token does not match provided one
:white_check_mark: When the user email for role validator is not used in the convention anymore
:white_check_mark: When the user email for role beneficiary is not used in the convention anymore
:white_check_mark: When the user email for role counsellor is not used in the convention anymore
:white_check_mark: When the user email for role establishment-representative is not used in the convention anymore
:white_check_mark: when the user has inclusion connect but not for the agency of this convention

:white_check_mark: Not found error

:white_check_mark: When the Convention does not exist
:white_check_mark: When if user is not on inclusion connected users

:white_check_mark: Right paths

:white_check_mark: Inclusion connected user

:white_check_mark: that have agency rights
:white_check_mark: that establishment rep is also the inclusion connected user
:white_check_mark: that establishment tutor is also the inclusion connected user
:white_check_mark: the user is backofficeAdmin

:white_check_mark: with ConventionJwtPayload

:white_check_mark: user 'establishment-representative' has no inclusion connect
:white_check_mark: user 'establishment-tutor' has no inclusion connect
:white_check_mark: user 'beneficiary' has no inclusion connect
:white_check_mark: user 'counsellor' has no inclusion connect
:white_check_mark: user 'validator' has no inclusion connect
:white_check_mark: user has inclusion connect
:white_check_mark: user is a PeAdvisor

src/domains/convention/use-cases/GetConventionForApiConsumer.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.263 s

:white_check_mark: Get Convention for ApiConsumer

:white_check_mark: Wrong paths

:white_check_mark: Forbidden error

:white_check_mark: When no api consumer is provided
:white_check_mark: When convention is not in the scope of the api consumer

:white_check_mark: convention is linked to an agency with an Id which is not
:white_check_mark: convention is linked to an agency with a kind not in scope

:white_check_mark: Not found error

:white_check_mark: When the Convention does not exist

:white_check_mark: Right path

:white_check_mark: when agencyIds scope matches
:white_check_mark: when agencyKinds scope matches

src/domains/convention/use-cases/GetConventionsForApiConsumer.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.225 s

:white_check_mark: Get Conventions for ApiConsumer

:white_check_mark: Forbidden error

:white_check_mark: When no api consumer is provided

:white_check_mark: returns only conventions in scope

:white_check_mark: when only agencyKinds

:white_check_mark: return empty array no convention matching agencyKinds
:white_check_mark: return convention matching agencyKinds
:white_check_mark: return convention matching agencyKinds with status IN_REVIEW

:white_check_mark: when only agencyIds

:white_check_mark: return empty array no convention matching agencyIds
:white_check_mark: return convention matching agencyIds

src/domains/convention/use-cases/notifications/NotifyActorThatConventionNeedsModifications.unit.test.ts [link]
10 passed, 0 failed, 0 todo, done in 0.367 s

:white_check_mark: NotifyActorThatConventionNeedsModifications

:white_check_mark: Right paths

:white_check_mark: Notify counsellor that application needs modification.
:white_check_mark: Notify beneficiary-representative that application needs modification.
:white_check_mark: Notify beneficiary-representative that application needs modification.
:white_check_mark: Notify beneficiary that application needs modification.
:white_check_mark: Notify beneficiary-current-employer that application needs modification.
:white_check_mark: Notify beneficiary-representative that application needs modification.
:white_check_mark: Notify validator that application needs modification.
:white_check_mark: Notify beneficiary that application needs modification.

:white_check_mark: Wrong paths

:white_check_mark: throw when modifier role is beneficiary current employer and that is not defined in convention
:white_check_mark: throw when modifier role is beneficiary representative and that is not defined in convention

src/domains/convention/use-cases/notifications/NotifyAgencyDelegationContact.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.238 s

:white_check_mark: NotifyAgencyDelegationContact

:white_check_mark: fail if tallyForm does not contain requested label
:white_check_mark: send an email to agency

src/domains/convention/use-cases/notifications/NotifyAgencyThatAssessmentIsCreated.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.496 s

:white_check_mark: NotifyAgencyThatAssessmentIsCreated

:white_check_mark: Throw when no convention were found
:white_check_mark: Throw when no agency were found
:white_check_mark: Send an email to validators

src/domains/convention/use-cases/notifications/NotifyAllActorsOfFinalConventionValidation.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 3.904 s

:white_check_mark: NotifyAllActorsOfFinalApplicationValidation

:white_check_mark: NotifyAllActorsOfFinalApplicationValidation sends confirmation email to all actors

:white_check_mark: Notify Default actors: beneficiary, establishement tutor, agency counsellor, agency validator that convention is validate.
:white_check_mark: With beneficiary current employer
:white_check_mark: With beneficiary representative
:white_check_mark: With different establishment tutor and establishment representative
:white_check_mark: With PeConnect Federated identity: beneficiary, establishment representative, agency counsellor & validator, and dedicated advisor
:white_check_mark: With PeConnect Federated identity: beneficiary, establishment tutor, agency counsellor & validator, and no advisor

src/domains/convention/use-cases/notifications/NotifyAllActorsThatConventionIsCancelled.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.239 s

:white_check_mark: NotifyBeneficiaryAndEnterpriseThatApplicationIsCancelled

:white_check_mark: Sends cancelation email to beneficiary, establishment tutor, and counsellors, validor, beneficiary Representativ and beneficiary current employer
:white_check_mark: doesn't send duplicated emails if validator email is also in counsellor emails and establishment tutor email is the same as establishment representative

src/domains/convention/use-cases/notifications/NotifyAllActorsThatConventionIsDeprecated.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.219 s

:white_check_mark: NotifyAllActorsThatApplicationIsDeprecated

:white_check_mark: Sends a conevention deprecated notification to all actors
:white_check_mark: doesn't send duplicated rejection emails if validator email is also in counsellor emails and establishment tutor email is the same as establishment representative

src/domains/convention/use-cases/notifications/NotifyAllActorsThatConventionIsRejected.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.52 s

:white_check_mark: NotifyBeneficiaryAndEnterpriseThatApplicationIsRejected

:white_check_mark: Sends rejection email to  beneficiary, establishment tutor, and counsellors, validor, beneficiary Representative and beneficiary current employer
:white_check_mark: doesn't send duplicated rejection emails if validator email is also in counsellor emails and establishment tutor email is the same as establishment representative

src/domains/convention/use-cases/notifications/NotifyConventionReminder.unit.test.ts [link]
55 passed, 0 failed, 0 todo, done in 3.967 s

:white_check_mark: NotifyThatConventionStillNeedToBeSigned use case

:white_check_mark: Wrong paths

:white_check_mark: Missing convention
:white_check_mark: Missing agency

:white_check_mark: Agency reminders

:white_check_mark: FirstReminderForAgency

:white_check_mark: Send email 'FirstReminderForAgency' to counsellors and validators when status is 'IN_REVIEW'
:white_check_mark: Forbidden cases on convention bad status

:white_check_mark: status 'READY_TO_SIGN'
:white_check_mark: status 'PARTIALLY_SIGNED'
:white_check_mark: status 'REJECTED'
:white_check_mark: status 'CANCELLED'
:white_check_mark: status 'DEPRECATED'
:white_check_mark: status 'DRAFT'
:white_check_mark: status 'ACCEPTED_BY_COUNSELLOR'
:white_check_mark: status 'ACCEPTED_BY_VALIDATOR'

:white_check_mark: LastReminderForAgency

:white_check_mark: Send email 'LastReminderForAgency' to counsellors and validators when status is 'IN_REVIEW'
:white_check_mark: Forbidden cases on convention bad status

:white_check_mark: status 'READY_TO_SIGN'
:white_check_mark: status 'PARTIALLY_SIGNED'
:white_check_mark: status 'REJECTED'
:white_check_mark: status 'CANCELLED'
:white_check_mark: status 'DEPRECATED'
:white_check_mark: status 'DRAFT'
:white_check_mark: status 'ACCEPTED_BY_COUNSELLOR'
:white_check_mark: status 'ACCEPTED_BY_VALIDATOR'

:white_check_mark: Signatories reminders

:white_check_mark: FirstReminderForSignatories

:white_check_mark: Send email 'FirstReminderForSignatories' to signatories when status is 'READY_TO_SIGN'.
Convention with same establishment representative & tutor without mobile phone
:white_check_mark: Send email 'FirstReminderForSignatories' to signatories when status is 'PARTIALLY_SIGNED'.
Convention with same establishment representative & tutor without mobile phone
:white_check_mark: Send email and SMS 'FirstReminderForSignatories' to signatories when status is 'READY_TO_SIGN'.
Convention with different establishment representative & tutor.
SMS are sent only for signatories that have not signed yet and have mobile phone.
:white_check_mark: Send email and SMS 'FirstReminderForSignatories' to signatories when status is 'PARTIALLY_SIGNED'.
Convention with different establishment representative & tutor.
SMS are sent only for signatories that have not signed yet and have mobile phone.
:white_check_mark: Send email 'FirstReminderForSignatories' to signatories when status is 'READY_TO_SIGN' and signatories have no mobile phones
:white_check_mark: Send email 'FirstReminderForSignatories' to signatories when status is 'PARTIALLY_SIGNED' and signatories have no mobile phones
:white_check_mark: Forbidden cases on convention bad status

:white_check_mark: status 'IN_REVIEW'
:white_check_mark: status 'REJECTED'
:white_check_mark: status 'CANCELLED'
:white_check_mark: status 'DEPRECATED'
:white_check_mark: status 'DRAFT'
:white_check_mark: status 'ACCEPTED_BY_COUNSELLOR'
:white_check_mark: status 'ACCEPTED_BY_VALIDATOR'

:white_check_mark: LastReminderForSignatories

:white_check_mark: Send email 'LastReminderForSignatories' to signatories when status is 'READY_TO_SIGN'.
Convention with same establishment representative & tutor
:white_check_mark: Send email 'LastReminderForSignatories' to signatories when status is 'PARTIALLY_SIGNED'.
Convention with same establishment representative & tutor
:white_check_mark: Send email 'LastReminderForSignatories' to signatories when status is 'READY_TO_SIGN'.
Convention with different establishment representative & tutor.
SMS are sent only for signatories that have not signed yet and have mobile phone.
:white_check_mark: Send email 'LastReminderForSignatories' to signatories when status is 'PARTIALLY_SIGNED'.
Convention with different establishment representative & tutor.
SMS are sent only for signatories that have not signed yet and have mobile phone.
:white_check_mark: Forbidden cases on convention bad status

:white_check_mark: status 'IN_REVIEW'
:white_check_mark: status 'REJECTED'
:white_check_mark: status 'CANCELLED'
:white_check_mark: status 'DEPRECATED'
:white_check_mark: status 'DRAFT'
:white_check_mark: status 'ACCEPTED_BY_COUNSELLOR'
:white_check_mark: status 'ACCEPTED_BY_VALIDATOR'

:white_check_mark: toSignatoriesSummary

:white_check_mark: should return the given text array if we only have a beneficiary and an establishment representative
:white_check_mark: should return the given text array if we have a minor beneficiary with a representative and an establishment representative
:white_check_mark: should return the given text array if we have a beneficiary with a current employer and an establishment representative

:white_check_mark: handle SMS DOM

:white_check_mark: Should send SMS with mobile phone +33600000001
:white_check_mark: Should send SMS with mobile phone +262639000001
:white_check_mark: Should send SMS with mobile phone +590690000001
:white_check_mark: Should send SMS with mobile phone +590691000001
:white_check_mark: Should send SMS with mobile phone +594694000001
:white_check_mark: Should send SMS with mobile phone +596696000001
:white_check_mark: Should send SMS with mobile phone +262692000001
:white_check_mark: Should send SMS with mobile phone +262693000001

src/domains/convention/use-cases/notifications/NotifyIcUserAgencyRightChanged.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.237 s

:white_check_mark: SendEmailWhenAgencyIsActivated

:white_check_mark: Wrong paths

:white_check_mark: throw error when no agency found
:white_check_mark: throw error when no user found
:white_check_mark: does nothing when user has no rights on agency

:white_check_mark: Right paths

:white_check_mark: Sends an email to counsellors with agency name
:white_check_mark: Sends an email to validators with agency name
:white_check_mark: Should not sends an email to validators with agency name when the new role is: to review

src/domains/convention/use-cases/notifications/NotifyIcUserAgencyRightRejected.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.802 s

:white_check_mark: Notify icUser agency right rejected

:white_check_mark: Throw when no agency were found
:white_check_mark: Throw when no icUser were found
:white_check_mark: Send an email to icUser to notify that registration to agency was rejected

src/domains/convention/use-cases/notifications/NotifyLastSigneeThatConventionHasBeenSigned.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.269 s

:white_check_mark: NotifyLastSigneeThatConventionHasBeenSigned

:white_check_mark: Last signed by beneficiary, no more signees
:white_check_mark: Last signed by establishment representative, beneficiary already signed
:white_check_mark: No one has signed the convention.
:white_check_mark: No convention on repository.

src/domains/convention/use-cases/notifications/NotifyNewConventionNeedsReview.unit.test.ts [link]
8 passed, 0 failed, 0 todo, done in 0.307 s

:white_check_mark: NotifyConventionNeedsReview

:white_check_mark: When convention status is IN_REVIEW

:white_check_mark: Nominal case: Sends notification email to councellor, with 2 existing councellors
:white_check_mark: No counsellors available: we fall back to validators: Sends notification email to those validators (using 2 of them)
:white_check_mark: No counsellors available, neither validators => ensure no mail is sent
:white_check_mark: sends notification to counsellors (when they exist), even if there is a peAdvisor
:white_check_mark: Sends notification email to peAdvisor and validators when beneficiary is PeConnected and beneficiary has PE advisor

:white_check_mark: When convention status is ACCEPTED_BY_COUNSELLOR

:white_check_mark: Nominal case: Sends notification email to validators
:white_check_mark: No validators available => ensure no mail is sent
:white_check_mark: Sends notification email to peAdvisor and validators when beneficiary is PeConnected and beneficiary has PE advisor

src/domains/convention/use-cases/notifications/NotifySignatoriesThatConventionSubmittedNeedsSignature.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.278 s

:white_check_mark: NotifySignatoriesThatConventionSubmittedNeedsSignature

:white_check_mark: Sends confirmation email to all signatories

src/domains/convention/use-cases/notifications/NotifySignatoriesThatConventionSubmittedNeedsSignatureAfterModification.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.303 s

:white_check_mark: NotifySignatoriesThatConventionSubmittedNeedsSignatureAfterModification

:white_check_mark: Right paths

:white_check_mark: Convention with minimal signatories
:white_check_mark: Convention without justification
:white_check_mark: Convention with all signatories

:white_check_mark: Wrong paths

:white_check_mark: Convention missing
:white_check_mark: Agency missing

src/domains/convention/use-cases/notifications/NotifyToAgencyConventionSubmitted.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.307 s

:white_check_mark: NotifyToAgencyConventionSubmitted

:white_check_mark: Sends notification email to agency validator when it is initially submitted, and agency has no counsellor
:white_check_mark: Sends notification email only counsellors with agency that have validators and counsellors
:white_check_mark: Sends notification email to agency with warning when beneficiary is PeConnected and beneficiary has no PE advisor
:white_check_mark: Sends notification email only to peAdvisor when beneficiary is PeConnected and beneficiary has PE advisor

src/domains/convention/use-cases/partners-errored-convention/MarkPartnersErroredConventionAsHandled.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.239 s

:white_check_mark: mark partners errored convention as handled

:white_check_mark: Mark partner errored convention as handled
:white_check_mark: Throw when convention is not errored
:white_check_mark: Throw when convention is errored but already handled
:white_check_mark: Throw when no jwt were provided
:white_check_mark: Throw when no convention was found
:white_check_mark: Throw when no user was found
:white_check_mark: Throw when user doesn't have right for agency

src/domains/convention/use-cases/RenewConvention.unit.test.ts [link]
11 passed, 0 failed, 0 todo, done in 0.299 s

:white_check_mark: RenewConvention

:white_check_mark: Happy paths

:white_check_mark: renews the convention with convention jwt payload
:white_check_mark: renews the convention with inclusionConnect admin jwt payload
:white_check_mark: renews the convention with inclusionConnect jwt payload

:white_check_mark: Wrong paths

:white_check_mark: throws an error when no JWT payload
:white_check_mark: throws an error when convention id in params does not match to convention id in JWT payload
:white_check_mark: throws an error when convention not found
:white_check_mark: throws an error when convention is not ACCEPTED_BY_VALIDATOR
:white_check_mark: throws an error when jwt role has not enough privileges
:white_check_mark: throws an error when missing inclusion connect user
:white_check_mark: throws an error when inclusion connect user has no rights on agency
:white_check_mark: throws an error when inclusion connect user has bad rights on agency

src/domains/convention/use-cases/RenewConventionMagicLink.unit.test.ts [link]
9 passed, 0 failed, 0 todo, done in 0.385 s

:white_check_mark: RenewConventionMagicLink use case

:white_check_mark: Right paths

:white_check_mark: Posts an event to deliver a correct JWT for correct responses for role beneficiary
:white_check_mark: Posts an event to deliver a correct JWT for correct responses for role beneficiary-current-employer
:white_check_mark: Posts an event to deliver a correct JWT for correct responses for role beneficiary-representative
:white_check_mark: Posts an event to deliver a correct JWT for correct responses for role establishment-representative
:white_check_mark: Also work when using encoded Url

:white_check_mark: Wrong paths

:white_check_mark: requires a valid application id
:white_check_mark: requires a known agency id
:white_check_mark: Refuses to generate backoffice magic links
:white_check_mark: does not accept to renew links from url that are not supported

src/domains/convention/use-cases/ResyncOldConventionsToPe.unit.test.ts [link]
8 passed, 0 failed, 0 todo, done in 0.311 s

:white_check_mark: ResyncOldConventionsToPe use case

:white_check_mark: Right paths

:white_check_mark: broadcast two conventions to pe
:white_check_mark: broadcast one convention to pe
:white_check_mark: no convention to sync
:white_check_mark: when agency is not kind pole-emploi
:white_check_mark: only process convention with status TO_PROCESS and ERROR
:white_check_mark: should consider limit

:white_check_mark: Wrong paths

:white_check_mark: when no convention in conventionRepository should not sync convention
:white_check_mark: when no agency

src/domains/convention/use-cases/SendEmailsWhenAgencyIsActivated.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.246 s

:white_check_mark: SendEmailWhenAgencyIsActivated

:white_check_mark: Sends activation email to counsellors and validators when agency without refers to id got activated
:white_check_mark: throw not found error if no agency were found with agency refers to id when agency refering to other activated
:white_check_mark: send a notification email to validating agency when agency refering to other was activated and one activation email to the counsellors of the agency refering to other

src/domains/convention/use-cases/SendEmailWhenAgencyIsRejected.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 3.819 s

:white_check_mark: SendEmailWhenAgencyIsRejected

:white_check_mark: Sends an email to validators with agency name
:white_check_mark: On missing agency
:white_check_mark: On agency not rejected

src/domains/convention/use-cases/SendEmailWhenNewAgencyOfTypeOtherAdded.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.2 s

:white_check_mark: Send email when agency of type other added

:white_check_mark: Sends email to counsellors and validators when agency of type other added
:white_check_mark: doesn't send an email to agency if agency is refering to other agency
:white_check_mark: doesn't send an email to agency if agency isn't of type 'autre'

src/domains/convention/use-cases/SignConvention.unit.test.ts [link]
24 passed, 0 failed, 0 todo, done in 0.318 s

:white_check_mark: Sign convention

:white_check_mark: wrong paths

:white_check_mark: Convention cannot be signed if it is not found in DB
:white_check_mark: forbidden roles with convention jwt

:white_check_mark: establishment-tutor is not allowed to sign
:white_check_mark: counsellor is not allowed to sign
:white_check_mark: validator is not allowed to sign
:white_check_mark: back-office is not allowed to sign
:white_check_mark: agency-admin is not allowed to sign
:white_check_mark: to-review is not allowed to sign
:white_check_mark: agency-viewer is not allowed to sign

:white_check_mark: with convention inclusion connect jwt

:white_check_mark: wh IC user is not establishment rep

:white_check_mark: bad statuses

:white_check_mark: IN_REVIEW initial status is not allowed
:white_check_mark: REJECTED initial status is not allowed
:white_check_mark: CANCELLED initial status is not allowed
:white_check_mark: DEPRECATED initial status is not allowed
:white_check_mark: DRAFT initial status is not allowed
:white_check_mark: ACCEPTED_BY_COUNSELLOR initial status is not allowed
:white_check_mark: ACCEPTED_BY_VALIDATOR initial status is not allowed

:white_check_mark: happy paths

:white_check_mark: with convention jwt

:white_check_mark: updates the convention with new signature for beneficiary
:white_check_mark: updates the convention with new signature for beneficiary-representative
:white_check_mark: updates the convention with new signature for beneficiary-current-employer
:white_check_mark: updates the convention with new signature for establishment-representative

:white_check_mark: with inclusion connect jwt

:white_check_mark: updates the convention with new signature for IC user when user is establisment representative

:white_check_mark: convention status transitions

:white_check_mark: goes from status READY_TO_SIGN to PARTIALLY_SIGNED, and saves corresponding event
:white_check_mark: goes from status PARTIALLY_SIGNED to PARTIALLY_SIGNED, and saves corresponding event
:white_check_mark: with 2 signatories, goes from status PARTIALLY_SIGNED to IN_REVIEW, and saves corresponding event

src/domains/convention/use-cases/UpdateConvention.unit.test.ts [link]
12 passed, 0 failed, 0 todo, done in 0.505 s

:white_check_mark: Update Convention

:white_check_mark: when user is not allowed

:white_check_mark: throws without jwtPayload
:white_check_mark: throws if inclusion connected user is not admin
:white_check_mark: throws if no convention id does not match the one in jwt payload

:white_check_mark: When the Convention is valid

:white_check_mark: updates the Convention in the repository

:white_check_mark: When no Convention with id exists

:white_check_mark: throws NotFoundError

:white_check_mark: When previous state is not draft (testing with READY_TO_SIGN)

:white_check_mark: throws Bad request

:white_check_mark: Update cases

:white_check_mark: With tutor different of establishment representative
:white_check_mark: With beneficiary current employer

:white_check_mark: Status validation

:white_check_mark: allows applications submitted as READY_TO_SIGN
:white_check_mark: rejects applications if the status is not DRAFT or READY_TO_SIGN
:white_check_mark: should emit ConventionSubmittedAfterModification event when successful
:white_check_mark: should throw forbidden Error if provided convention has status DRAFT

src/domains/convention/use-cases/UpdateConventionStatus.unit.test.ts [link]
273 passed, 0 failed, 0 todo, done in 4.315 s

:white_check_mark: UpdateConventionStatus

:white_check_mark: * -> DRAFT transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005251

:white_check_mark: Accepted from role 'beneficiary'
:white_check_mark: Accepted from role 'establishment-representative'
:white_check_mark: Accepted from role 'beneficiary-representative'
:white_check_mark: Accepted from role 'beneficiary-current-employer'
:white_check_mark: Accepted from role 'counsellor'
:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from role 'back-office'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status READY_TO_SIGN
:white_check_mark: Accepted from status PARTIALLY_SIGNED
:white_check_mark: Accepted from status IN_REVIEW
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005252

:white_check_mark: Accepted from role 'beneficiary'
:white_check_mark: Accepted from role 'establishment-representative'
:white_check_mark: Accepted from role 'beneficiary-representative'
:white_check_mark: Accepted from role 'beneficiary-current-employer'
:white_check_mark: Accepted from role 'counsellor'
:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from role 'back-office'
:white_check_mark: Accepted from userId 'icUserWithRoleCounsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status READY_TO_SIGN
:white_check_mark: Accepted from status PARTIALLY_SIGNED
:white_check_mark: Accepted from status IN_REVIEW
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status DRAFT
:white_check_mark: Rejected from status ACCEPTED_BY_VALIDATOR

:white_check_mark: Accept from role establishment-representative when convention is requested to be modified for the second time
:white_check_mark: ConventionRequiresModification event only has the role of the user that requested the change
:white_check_mark: Throw when no agency was found
:white_check_mark: Throw when modifier role is counsellor or validator and that no mail adress were found

:white_check_mark: * -> READY_TO_SIGN transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005251

:white_check_mark: Accepted from role 'beneficiary'
:white_check_mark: Accepted from role 'beneficiary-representative'
:white_check_mark: Accepted from role 'beneficiary-current-employer'
:white_check_mark: Accepted from role 'establishment-representative'
:white_check_mark: Accepted from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Accepted from status DRAFT

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'counsellor'
:white_check_mark: Rejected from role 'validator'
:white_check_mark: Rejected from role 'back-office'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleCounsellor'
:white_check_mark: Rejected from userId 'icUserWithRoleValidator'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Rejected from status READY_TO_SIGN
:white_check_mark: Rejected from status PARTIALLY_SIGNED
:white_check_mark: Rejected from status IN_REVIEW
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status ACCEPTED_BY_COUNSELLOR
:white_check_mark: Rejected from status ACCEPTED_BY_VALIDATOR

:white_check_mark: * -> PARTIALLY_SIGNED transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005251

:white_check_mark: Accepted from role 'beneficiary'
:white_check_mark: Accepted from role 'beneficiary-representative'
:white_check_mark: Accepted from role 'beneficiary-current-employer'
:white_check_mark: Accepted from role 'establishment-representative'
:white_check_mark: Accepted from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Accepted from status READY_TO_SIGN
:white_check_mark: Accepted from status PARTIALLY_SIGNED

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'counsellor'
:white_check_mark: Rejected from role 'validator'
:white_check_mark: Rejected from role 'back-office'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleCounsellor'
:white_check_mark: Rejected from userId 'icUserWithRoleValidator'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Rejected from status IN_REVIEW
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status DRAFT
:white_check_mark: Rejected from status ACCEPTED_BY_COUNSELLOR
:white_check_mark: Rejected from status ACCEPTED_BY_VALIDATOR

:white_check_mark: * -> IN_REVIEW transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005251

:white_check_mark: Accepted from role 'beneficiary'
:white_check_mark: Accepted from role 'beneficiary-representative'
:white_check_mark: Accepted from role 'beneficiary-current-employer'
:white_check_mark: Accepted from role 'establishment-representative'
:white_check_mark: Accepted from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Accepted from status PARTIALLY_SIGNED

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'counsellor'
:white_check_mark: Rejected from role 'validator'
:white_check_mark: Rejected from role 'back-office'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleCounsellor'
:white_check_mark: Rejected from userId 'icUserWithRoleValidator'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Rejected from status READY_TO_SIGN
:white_check_mark: Rejected from status IN_REVIEW
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status DRAFT
:white_check_mark: Rejected from status ACCEPTED_BY_COUNSELLOR
:white_check_mark: Rejected from status ACCEPTED_BY_VALIDATOR

:white_check_mark: * -> ACCEPTED_BY_COUNSELLOR transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005252

:white_check_mark: Accepted from role 'counsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleCounsellor'
:white_check_mark: Accepted from status IN_REVIEW

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'beneficiary'
:white_check_mark: Rejected from role 'beneficiary-representative'
:white_check_mark: Rejected from role 'beneficiary-current-employer'
:white_check_mark: Rejected from role 'establishment-representative'
:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'validator'
:white_check_mark: Rejected from role 'back-office'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleValidator'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Rejected from status READY_TO_SIGN
:white_check_mark: Rejected from status PARTIALLY_SIGNED
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status DRAFT
:white_check_mark: Rejected from status ACCEPTED_BY_COUNSELLOR
:white_check_mark: Rejected from status ACCEPTED_BY_VALIDATOR

:white_check_mark: * -> ACCEPTED_BY_VALIDATOR transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005251

:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status IN_REVIEW
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'beneficiary'
:white_check_mark: Rejected from role 'beneficiary-representative'
:white_check_mark: Rejected from role 'beneficiary-current-employer'
:white_check_mark: Rejected from role 'establishment-representative'
:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'counsellor'
:white_check_mark: Rejected from role 'back-office'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleCounsellor'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Rejected from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Rejected from status READY_TO_SIGN
:white_check_mark: Rejected from status PARTIALLY_SIGNED
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status DRAFT
:white_check_mark: Rejected from status ACCEPTED_BY_VALIDATOR

:white_check_mark: When agency have two steps validation

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005252

:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR

:white_check_mark: * -> REJECTED transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005251

:white_check_mark: Accepted from role 'back-office'
:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from role 'counsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status PARTIALLY_SIGNED
:white_check_mark: Accepted from status READY_TO_SIGN
:white_check_mark: Accepted from status IN_REVIEW
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005252

:white_check_mark: Accepted from role 'back-office'
:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from role 'counsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleCounsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status PARTIALLY_SIGNED
:white_check_mark: Accepted from status READY_TO_SIGN
:white_check_mark: Accepted from status IN_REVIEW
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR
:white_check_mark: Accepted from role 'back-office'
:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from role 'counsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleCounsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status PARTIALLY_SIGNED
:white_check_mark: Accepted from status READY_TO_SIGN
:white_check_mark: Accepted from status IN_REVIEW
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'beneficiary'
:white_check_mark: Rejected from role 'beneficiary-representative'
:white_check_mark: Rejected from role 'beneficiary-current-employer'
:white_check_mark: Rejected from role 'establishment-representative'
:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status DRAFT
:white_check_mark: Rejected from status ACCEPTED_BY_VALIDATOR

:white_check_mark: * -> CANCELLED transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005251

:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from role 'back-office'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status ACCEPTED_BY_VALIDATOR

:white_check_mark: Rejected

:white_check_mark: Rejected from role 'beneficiary'
:white_check_mark: Rejected from role 'beneficiary-representative'
:white_check_mark: Rejected from role 'beneficiary-current-employer'
:white_check_mark: Rejected from role 'establishment-representative'
:white_check_mark: Rejected from role 'establishment-tutor'
:white_check_mark: Rejected from role 'counsellor'
:white_check_mark: Rejected from role 'agency-admin'
:white_check_mark: Rejected from role 'to-review'
:white_check_mark: Rejected from role 'agency-viewer'
:white_check_mark: Rejected from userId 'icUserWithRoleToReview'
:white_check_mark: Rejected from userId 'icUserWithRoleCounsellor'
:white_check_mark: Rejected from userId 'icUserWithRoleAgencyAdmin'
:white_check_mark: Rejected from userId 'icUserWithRoleEstablishmentRepresentative'
:white_check_mark: Rejected from status READY_TO_SIGN
:white_check_mark: Rejected from status PARTIALLY_SIGNED
:white_check_mark: Rejected from status IN_REVIEW
:white_check_mark: Rejected from status REJECTED
:white_check_mark: Rejected from status CANCELLED
:white_check_mark: Rejected from status DEPRECATED
:white_check_mark: Rejected from status DRAFT
:white_check_mark: Rejected from status ACCEPTED_BY_COUNSELLOR

:white_check_mark: * -> DEPRECATED transition

:white_check_mark: Accepted with convention id add5c20e-6dd2-45af-affe-927358005252

:white_check_mark: Accepted from role 'back-office'
:white_check_mark: Accepted from role 'validator'
:white_check_mark: Accepted from role 'counsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleCounsellor'
:white_check_mark: Accepted from userId 'icUserWithRoleValidator'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdmin'
:white_check_mark: Accepted from userId 'icUserWithRoleBackofficeAdminAndValidator'
:white_check_mark: Accepted from status PARTIALLY_SIGNED
:white_check_mark: Accepted from status READY_TO_SIGN
:white_check_mark: Accepted from status IN_REVIEW
:white_check_mark: Accepted from status ACCEPTED_BY_COUNSELLOR
:white_check_mark: Accepted from status DRAFT

:white_check_mark: fails for unknown convention ids

src/domains/core/address/use-cases/LookupLocation.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.187 s

:white_check_mark: Lookup Street Address

:white_check_mark: retrieve location search result from query ''

src/domains/core/address/use-cases/LookupStreetAddress.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.181 s

:white_check_mark: Lookup Street Address

:white_check_mark: retrieve Street and Addresse from query ''

src/domains/core/api-consumer/use-cases/BroadcastToPartnersOnConventionUpdates.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.296 s

:white_check_mark: Broadcast to partners on updated convention

:white_check_mark: broadcast updated convention to agency only
:white_check_mark: save webhook error
:white_check_mark: save feedback success
:white_check_mark: broadcast updated convention to agency and agency refered to

src/domains/core/api-consumer/use-cases/DeleteSubscription.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.212 s

:white_check_mark: DeleteSubscription

:white_check_mark: throws error when apiConsumer does not have the rights
:white_check_mark: delete a webhook subscription
:white_check_mark: throws 404 when subscription not found

src/domains/core/api-consumer/use-cases/ListActiveSubscriptions.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.205 s

:white_check_mark: ListActiveSubscriptions

:white_check_mark: returns empty list if no subscriptions
:white_check_mark: returns subscriptions

src/domains/core/api-consumer/use-cases/SaveApiConsumer.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.258 s

:white_check_mark: SaveApiConsumer

:white_check_mark: Right paths

:white_check_mark: Adds a new api consumer if not existing
:white_check_mark: Updates an existing api consumer, except subscriptions

:white_check_mark: Wrong paths

:white_check_mark: UnauthorizedError on without JWT payload
:white_check_mark: ForbiddenError on if provided JWT payload is not a backoffice one

src/domains/core/api-consumer/use-cases/SubscribeToWebhook.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.205 s

:white_check_mark: SubscribeToWebhook

:white_check_mark: throws a forbidden error when jwtPayload is not provided
:white_check_mark: adds the subscription

src/domains/core/authentication/inclusion-connect/use-cases/AuthenticateWithInclusionCode.unit.test.ts [link]
22 passed, 0 failed, 0 todo, done in 0.334 s

:white_check_mark: AuthenticateWithInclusionCode use case

:white_check_mark: With OAuthGateway provider 'inclusionConnect'

:white_check_mark: right paths

:white_check_mark: when user had never connected before

:white_check_mark: saves the user as Authenticated user
:white_check_mark: updates ongoingOAuth with userId, accessToken and externalId
:white_check_mark: saves UserConnectedSuccessfully event with relevant data

:white_check_mark: when user has already exists as an Authenticated User

:white_check_mark: updates the user as Authenticated user
:white_check_mark: also work if the existing user was not inclusion connected (no externalId)
:white_check_mark: when user change its email on inclusion connect

:white_check_mark: handle dynamic login pages

:white_check_mark: generates an app token and returns a redirection url which includes token and user data for agencyDashboard
:white_check_mark: generates an app token and returns a redirection url which includes token and user data for establishmentDashboard
:white_check_mark: generates an app token and returns a redirection url which includes token and user data for admin

:white_check_mark: wrong paths

:white_check_mark: rejects the connection if no state match the provided one in DB
:white_check_mark: should raise a Forbidden error if the nonce does not match

:white_check_mark: With OAuthGateway provider 'proConnect'

:white_check_mark: right paths

:white_check_mark: when user had never connected before

:white_check_mark: saves the user as Authenticated user
:white_check_mark: updates ongoingOAuth with userId, accessToken and externalId
:white_check_mark: saves UserConnectedSuccessfully event with relevant data

:white_check_mark: when user has already exists as an Authenticated User

:white_check_mark: updates the user as Authenticated user
:white_check_mark: also work if the existing user was not inclusion connected (no externalId)
:white_check_mark: when user change its email on inclusion connect

:white_check_mark: handle dynamic login pages

:white_check_mark: generates an app token and returns a redirection url which includes token and user data for agencyDashboard
:white_check_mark: generates an app token and returns a redirection url which includes token and user data for establishmentDashboard
:white_check_mark: generates an app token and returns a redirection url which includes token and user data for admin

:white_check_mark: wrong paths

:white_check_mark: rejects the connection if no state match the provided one in DB
:white_check_mark: should raise a Forbidden error if the nonce does not match

src/domains/core/authentication/inclusion-connect/use-cases/GetInclusionConnectLogoutUrl.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.226 s

:white_check_mark: GetInclusionConnectLogoutUrl

:white_check_mark: With OAuthGateway provider 'inclusionConnect'

:white_check_mark: throws when it does not find the ongoingOAuth
:white_check_mark: returns the inclusion connect logout url from %s

:white_check_mark: With OAuthGateway provider 'proConnect'

:white_check_mark: throws when it does not find the ongoingOAuth
:white_check_mark: returns the inclusion connect logout url from %s

src/domains/core/authentication/inclusion-connect/use-cases/InitiateInclusionConnect.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.184 s

:white_check_mark: InitiateInclusionConnect usecase

:white_check_mark: With OAuthGateway mode 'inclusionConnect'

:white_check_mark: construct redirect url for agencyDashboard with expected query params, and stores nounce and state in ongoingOAuth
:white_check_mark: construct redirect url for establishmentDashboard with expected query params, and stores nounce and state in ongoingOAuth
:white_check_mark: construct redirect url for admin with expected query params, and stores nounce and state in ongoingOAuth

:white_check_mark: With OAuthGateway mode 'proConnect'

:white_check_mark: construct redirect url for agencyDashboard with expected query params, and stores nounce and state in ongoingOAuth
:white_check_mark: construct redirect url for establishmentDashboard with expected query params, and stores nounce and state in ongoingOAuth
:white_check_mark: construct redirect url for admin with expected query params, and stores nounce and state in ongoingOAuth

src/domains/core/authentication/pe-connect/use-cases/BindConventionToFederatedIdentity.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.267 s

:white_check_mark: AssociatePeConnectFederatedIdentity

:white_check_mark: should not associate convention if no federatedIdentity is provided
:white_check_mark: authfailed
:white_check_mark: should associate convention and federated identity if the federated identity match format
:white_check_mark: should save event PeConnectFederatedIdentityAssociated
:white_check_mark: without advisor
:white_check_mark: without open slot then no association and FederatedIdentityNotBoundToConvention event

src/domains/core/authentication/pe-connect/use-cases/LinkPoleEmploiAdvisorAndRedirectToConvention.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.276 s

:white_check_mark: LinkPoleEmploiAdvisorAndRedirectToConvention

:white_check_mark: Pe Connect correctly identify OAuth

:white_check_mark: the returned conventionAdvisor gets stored
:white_check_mark: only PLACEMENT and CAPEMPLOI advisor types are valid for conventionAdvisor
:white_check_mark: the OAuth info and federated identity are present in the redirect url query parameters

:white_check_mark: Wrong path

:white_check_mark: On PeConnect auth failure
:white_check_mark: On PeConnect not user info
:white_check_mark: On PeConnected and is not jobseeker should not open slot and provide convention url with notJobSeeker peConnect mode

:white_check_mark: On PeConnected and is jobseeker but no advisors should open slot

src/domains/core/authentication/pe-connect/use-cases/NotifyPoleEmploiUserAdvisorOnConventionFullySigned.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.243 s

:white_check_mark: NotifyPoleEmploiUserAdvisorOnConventionFullySigned

:white_check_mark: should resolve to undefined if the convention France Travail OAuth advisor is not found
:white_check_mark: should send email with the correct params
:white_check_mark: peConnected without advisor

src/domains/core/caching-gateway/adapters/InMemoryCachingGateway.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.098 s

:white_check_mark: InMemoryCachingGateway with GetAccessTokenResponse

:white_check_mark: fetches a new token if none is cached
:white_check_mark: returns the cached token while it's not expired
:white_check_mark: refreshes the cached token when it's expired
:white_check_mark: tokens with less than 30 sec until expiry are considered expired
:white_check_mark: multiple requests wait the same token while it is being refreshed

src/domains/core/email-validation/use-cases/ValidateEmail.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.202 s

:white_check_mark: Email validation status

:white_check_mark: retrieve email validation status from queried email
:white_check_mark: should throw an error

src/domains/core/events/adapters/InMemoryEventBus.unit.test.ts [link]
10 passed, 0 failed, 0 todo, done in 0.373 s

:white_check_mark: InMemoryEventBus

:white_check_mark: Publish to an existing topic

:white_check_mark: Marks event as published even if no-one was subscribed to it
:white_check_mark: Publishes to a new topic and check we have only one spyed event

:white_check_mark: Publish to the same topic and check that 2 subscribers get the message
:white_check_mark: when one of the handlers fails

:white_check_mark: catch the error and flags the failing subscriber

:white_check_mark: when republishing an already published event that has failed

:white_check_mark: saves the new publications linked to the event
:white_check_mark: only re-executes the subscriptions that failed
:white_check_mark: does the work on the last publications even if it is not ordered in event publication
:white_check_mark: puts the event in quarantine if it fails at the 4th try

:white_check_mark: when forcing an event to republish

:white_check_mark: republishes the event and executes all the subscriptions (even if some have succeeded)

:white_check_mark: getLastPublication

:white_check_mark: get only the last publication

src/domains/core/feature-flags/use-cases/SetFeatureFlag.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.209 s

:white_check_mark: SetFeatureFlag use case

:white_check_mark: throws Unauthorized if no currentUser is provided
:white_check_mark: throws Forbidden if currentUser user is not admin
:white_check_mark: saves the feature flag
:white_check_mark: updates the feature flag

src/domains/core/notifications/adapters/BrevoNotificationGateway.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 3.439 s

:white_check_mark: BrevoNotificationGateway unit

:white_check_mark: sendEmail with skipEmailAllowList false

:white_check_mark: should throw if no recipient is provided
:white_check_mark: should not send email if recipient are not in white list
:white_check_mark: should filter emails according to predicate
:white_check_mark: should filter email and carbon copy according to predicate

:white_check_mark: sendEmail with skipEmailAllowList true

:white_check_mark: shouldn't send emails to email containing blacklisted domain
:white_check_mark: should send emails but not to emails containing blacklisted domain

src/domains/core/notifications/useCases/SendNotification.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.197 s

:white_check_mark: SendNotification UseCase

:white_check_mark: Wrong paths

:white_check_mark: should throw if notification not found
:white_check_mark: when error occurres in SMS sending

:white_check_mark: should send an email
:white_check_mark: should send an SMS

src/domains/core/pdf-generation/use-cases/HtmlToPdf.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.197 s

:white_check_mark: HtmlToPdf

:white_check_mark: renders a pdf from a html content
:white_check_mark: returns an error if the html content is empty
:white_check_mark: returns an error if no JWT is provided

src/domains/core/retry-strategy/adapters/ExponentialBackoffRetryStrategy.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.203 s

:white_check_mark: ExponentialBackoffRetryStrategy

:white_check_mark: no retry on callback success
:white_check_mark: no retry of non-retryable error
:white_check_mark: exponential backoff on retryable errors
:white_check_mark: exponential backoff period is truncated at maxbackoffPeriodMs
:white_check_mark: aborts after timeout exceeded

src/domains/core/rome/use-cases/AppellationSearch.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.227 s

:white_check_mark: AppellationSearch

:white_check_mark: returns the list of found matches with ranges
:white_check_mark: returns the list of found matches with ranges from minimum search caracters
:white_check_mark: issues no queries for short search texts
:white_check_mark: returns empty list when no match is found
:white_check_mark: with natural language search

:white_check_mark: returns the list of found matches with ranges
:white_check_mark: do not return results if missing on rome repo like ROME 4 results
:white_check_mark: returns empty array if no match

src/domains/core/rome/use-cases/RomeSearch.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.202 s

:white_check_mark: RomeSearch

:white_check_mark: returns the list of found matches with ranges
:white_check_mark: issues no queries for short search texts

src/domains/core/sirene/adapters/AnnuaireDesEntreprisesSiretGateway.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.159 s

:white_check_mark: convertAdeEstablishmentToSirenEstablishmentDto

:white_check_mark: marks an open establishment as open, regardless of the period count
:white_check_mark: returns the parsed info when siret found
:white_check_mark: falls back to nom_complet if response does not contain nom_commercial
:white_check_mark: falls back to nom_complet if response contains an empty nom_commercial

src/domains/core/sirene/adapters/InseeSiretGateway.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.272 s

:white_check_mark: convertSirenRawEstablishmentToSirenEstablishmentDto

:white_check_mark: marks an open establishment as open, regardless of the period count
:white_check_mark: returns the parsed info when siret found
:white_check_mark: populates businessName from nom/prenom when denomination not available
:white_check_mark: skips missing parts of adresseEtablissment
:white_check_mark: skips naf when not available
:white_check_mark: returns establishment as not Open if it is not at the current period

src/domains/core/sirene/use-cases/GetSiret.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.192 s

:white_check_mark: GetSiret

:white_check_mark: checking for business being opened

:white_check_mark: marks an open establishment as open, regardless of the period count

:white_check_mark: throws NotFoundError where siret not found
:white_check_mark: returns unavailable Api error if it gets a 429 from API

src/domains/core/sirene/use-cases/GetSiretIfNotAlreadySaved.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.193 s

:white_check_mark: GetSiretIfNotAlreadySaved

:white_check_mark: throws an error if the siret is already saved
:white_check_mark: returns the establishment info if not already in DB

src/domains/core/statistics/use-cases/GetEstablishmentStats.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.213 s

:white_check_mark: GetEstablishmentStats

:white_check_mark: throws Forbidden if ApiConsumer does not have 'READ' right on establishmentStats
:white_check_mark: throws BadRequest if perPage is greater than the max allowed
:white_check_mark: gets the content

src/domains/establishment/use-cases/AddEstablishmentLead.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.252 s

:white_check_mark: Add EstablishmentLead

:white_check_mark: do not add lead if convention is not ACCEPTED_BY_VALIDATOR
:white_check_mark: do nothing if establishmentLead already exists
:white_check_mark: do nothing if establishment already exists
:white_check_mark: Add new establishment lead

src/domains/establishment/use-cases/AddFormEstablishment.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.243 s

:white_check_mark: Add FormEstablishment

:white_check_mark: saves an establishment in the repository
:white_check_mark: considers appellation_code as a reference, and ignores the labels, and rome (it fetches the one matching the appellation code anyways)
:white_check_mark: cannot save an establishment with same siret
:white_check_mark: SIRET validation

:white_check_mark: rejects formEstablishment with SIRETs that don't correspond to active businesses
:white_check_mark: accepts formEstablishment with SIRETs that  correspond to active businesses
:white_check_mark: Throws errors when the SIRET endpoint throws erorrs

src/domains/establishment/use-cases/AddFormEstablismentsBatch.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.27 s

:white_check_mark: AddFormEstablishmentsBatch Use Case

:white_check_mark: throws Unauthorized if no currentUser is provided
:white_check_mark: throws Forbidden if currentUser user is not admin
:white_check_mark: Adds two formEstablishments successfully and returns report
:white_check_mark: reports the errors when something goes wrong with an addition
:white_check_mark: Saves an event with topic : 'FormEstablishmentAdded'
:white_check_mark: creates the establishmentGroup with the sirets of the establishments
:white_check_mark: updates Group if it already exists

src/domains/establishment/use-cases/ContactEstablishment.unit.test.ts [link]
10 passed, 0 failed, 0 todo, done in 3.959 s

:white_check_mark: ContactEstablishment

:white_check_mark: Right paths

:white_check_mark: schedules event for valid EMAIL contact request
:white_check_mark: schedules event for valid PHONE contact request
:white_check_mark: schedules event for valid IN_PERSON contact requests
:white_check_mark: creates a Discussion Aggregate and adds in to repo
:white_check_mark: switches establishment is searchable to false when the max contacts per week is reached

:white_check_mark: Wrong paths

:white_check_mark: throws ConflictError if a recent contact requests already exists for the same potential beneficiary email, siret and appellation
:white_check_mark: throws BadRequestError for contact mode mismatch
:white_check_mark: throws NotFoundError when no establishments found with given siret
:white_check_mark: throws BadRequestError when no offers found in establishment with given appellationCode
:white_check_mark: throws ForbidenError when establishment is not currently available

src/domains/establishment/use-cases/ContactRequestReminder.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.239 s

:white_check_mark: ContactRequestReminder

:white_check_mark: wrong paths

:white_check_mark: no discussion with missing establishment response since 3 or 7 days
:white_check_mark: no discussion when establishment already answered
:white_check_mark: no discussion with status other than PENDING

:white_check_mark: right paths

:white_check_mark: when discussion with missing establishment response 3 days after
:white_check_mark: when discussion with missing establishment response 7 days after

src/domains/establishment/use-cases/DeleteEstablishment.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.249 s

:white_check_mark: Delete Establishment

:white_check_mark: Wrong paths

:white_check_mark: Throws forbidden error on missing backoffice jwt
:white_check_mark: Throws not found error on missing establishment aggregate
:white_check_mark: Throws not found error on missing form establishment

:white_check_mark: Right paths

:white_check_mark: Establishment aggregate and form establishment are deleted, establishment group with siret have siret removed

src/domains/establishment/use-cases/discussions/AddExchangeToDiscussion.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.254 s

:white_check_mark: AddExchangeToDiscussion

:white_check_mark: right paths

:white_check_mark: saves the new exchange in the discussion with attachment ref
:white_check_mark: saves the new exchange in the discussion with attachment ref and with a default subject if not provided

:white_check_mark: wrong paths

:white_check_mark: throws an error if the email does not have the right format
:white_check_mark: throws an error if the email does not have the right recipient kind
:white_check_mark: throws an error if the discussion does not exist

src/domains/establishment/use-cases/discussions/GetDiscussionByIdForEstablishment.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.243 s

:white_check_mark: GetDiscussionById use case

:white_check_mark: Failure cases

:white_check_mark: cannot process if no jwt provided
:white_check_mark: throws NotFound when user cannot be found
:white_check_mark: throws NotFound when discussion cannot be found
:white_check_mark: cannot access someone else's discussions

:white_check_mark: Happy path

:white_check_mark: Gets the matching discussion based on establishment contact email
:white_check_mark: Gets the matching discussion based on establishment copy emails
:white_check_mark: Gets the matching discussion based on establishment copy emails and contact email

src/domains/establishment/use-cases/discussions/MarkDiscussionLinkedToConvention.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.226 s

:white_check_mark: MarkDiscussionLinkedToConvention

:white_check_mark: does nothing if discussionId is not provided
:white_check_mark: throws NotFoundError if discussion is not found
:white_check_mark: updates the discussion when siret matches the one of the convention

src/domains/establishment/use-cases/discussions/RejectDiscussionAndSendNotification.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.255 s

:white_check_mark: RejectDiscussionAndSendNotification

:white_check_mark: throws NotFoundError if discussion is not found
:white_check_mark: throws ForbiddenError if user is not allowed to reject this discussion
:white_check_mark: throws BadRequestError if discussion is already rejected
:white_check_mark: rejects discussion with kind but no reason provided (rejectionKind !== OTHER)
:white_check_mark: rejects discussion with kind and reason provided (rejectionKind === OTHER)

src/domains/establishment/use-cases/discussions/SendExchangeToRecipient.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.277 s

:white_check_mark: SendExchangeToRecipient

:white_check_mark: right paths

:white_check_mark: sends the email to the right recipient (response from establishment to potential beneficiary)
:white_check_mark: sends the email with a default message if not provided

:white_check_mark: wrong paths

:white_check_mark: throws an error if the discussion does not exist
:white_check_mark: throws an error if appellation code does not exist
:white_check_mark: throws an error if discussion does not have exchanges

src/domains/establishment/use-cases/EditFormEstablishment.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 0.272 s

:white_check_mark: Edit Form Establishment

:white_check_mark: Wrong paths

:white_check_mark: Forbidden error on EstablishmentJwtPayload with bad siret
:white_check_mark: Not found error if user is not found
:white_check_mark: Forbidden error on InclusionConnectJwtPayload with ic user that doesn't have rights on establishment
:white_check_mark: Forbidden error without jwt payload
:white_check_mark: conflict error when form does not exist

:white_check_mark: Right paths

:white_check_mark: publish a FormEstablishmentEdited event & update formEstablishment on repository with an establishment payload
:white_check_mark: publish a FormEstablishmentEdited event & update formEstablishment on repository with a IC payload with user with backoffice rights

src/domains/establishment/use-cases/GetExternalSearchResult.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.214 s

:white_check_mark: GetExternalSearchResult

:white_check_mark: Wrong paths

:white_check_mark: throws a not found error if the siret is not found in gateway
:white_check_mark: throws a not found error if the appellations doesn't refers to a rome
:white_check_mark: throws a not found error if the siret refers to a deleted establishment

:white_check_mark: Right paths

:white_check_mark: returns the search result

src/domains/establishment/use-cases/InsertEstablishmentAggregateFromFormEstablishement.unit.test.ts [link]
7 passed, 0 failed, 0 todo, done in 3.965 s

:white_check_mark: Insert Establishment aggregate from form data

:white_check_mark: Converts Form Establishment in Aggregate

:white_check_mark: And create user that doesn't exist by email
:white_check_mark: And doesn't modify user that aldready exist by email
:white_check_mark: Avoid making same establishment right mapping when same email is used in admin and copy contacts
:white_check_mark: Avoid making same establishment right mapping when same email is used in copy contacts

:white_check_mark: Correctly converts establishment with a 'tranche d'effectif salarié' of 00
:white_check_mark: Throws if establishment and offers with same siret already exists
:white_check_mark: Publishes an event with the new establishment aggregate as payload

src/domains/establishment/use-cases/LegacyContactEstablishment.unit.test.ts [link]
10 passed, 0 failed, 0 todo, done in 0.329 s

:white_check_mark: LegacyContactEstablishment

:white_check_mark: schedules event for valid EMAIL contact request
:white_check_mark: schedules event for valid PHONE contact request
:white_check_mark: schedules event for valid IN_PERSON contact requests
:white_check_mark: creates a Discussion Aggregate and adds in to repo
:white_check_mark: switches establishment is searchable to false when the max contacts per week is reached
:white_check_mark: Wrong paths

:white_check_mark: throws ConflictError if a recent contact requests already exists for the same potential beneficiary email, siret and appellation
:white_check_mark: throws BadRequestError for contact mode mismatch
:white_check_mark: throws NotFoundError when no establishments found with given siret
:white_check_mark: throws BadRequestError when no offers found in establishment with given appellationCode
:white_check_mark: throws ForbidenError when establishment is not currently available

src/domains/establishment/use-cases/MarkEstablishmentLeadAsRegistrationAccepted.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.2 s

:white_check_mark: UpdateEstablishmentLeadOnEstablishmentRegistered

:white_check_mark: do nothing when no establishment were found
:white_check_mark: update establishment lead status to 'registration-accepted'

src/domains/establishment/use-cases/MarkEstablishmentLeadAsRegistrationRejected.unit.test.ts [link]
4 passed, 0 failed, 0 todo, done in 0.221 s

:white_check_mark: MarkEstablishmentLeadAsRegistrationRejected

:white_check_mark: throw not found error when convention not found
:white_check_mark: throw not found error when establishment lead not found
:white_check_mark: update establishmentLead's kind
:white_check_mark: doesn't update establishmentLead's kind when last event king is already registration rejected

src/domains/establishment/use-cases/notifications/NotifyConfirmationEstablishmentCreated.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.19 s

:white_check_mark: NotifyConfirmationEstablishmentCreated

:white_check_mark: When establishment is valid

:white_check_mark: Nominal case: Sends notification email to Establisment contact

src/domains/establishment/use-cases/notifications/NotifyContactRequest.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.26 s

:white_check_mark: NotifyContactRequest

:white_check_mark: Right paths

:white_check_mark: Sends ContactByEmailRequest email to establishment
:white_check_mark: Sends ContactByPhoneRequest email to potential beneficiary
:white_check_mark: Sends ContactInPersonRequest email to potential beneficiary

:white_check_mark: wrong paths

:white_check_mark: Missing discussion
:white_check_mark: Bad immersion offer with contactMode $contactMode

src/domains/establishment/use-cases/notifications/NotifyPassEmploiOnNewEstablishmentAggregateInsertedFromForm.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.564 s

:white_check_mark: Notify pass-emploi

:white_check_mark: Calls pass-emploi API with formatted immersion offers from just inserted aggregate

src/domains/establishment/use-cases/RequestEditFormEstablishment.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 0.193 s

:white_check_mark: RequestUpdateFormEstablishment

:white_check_mark: If no email has been sent yet.

:white_check_mark: Sends an email to the contact of the establishment with eventually email in CC

:white_check_mark: if email has been sent

:white_check_mark: should resend a request establishment link successfully
:white_check_mark: Sends a new email if the edit link in last email has expired

src/domains/establishment/use-cases/RetrieveFormEstablishmentFromAggregates.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.236 s

:white_check_mark: Retrieve Form Establishment From Aggregate when payload is valid

:white_check_mark: throws an error if there is no jwt
:white_check_mark: throws an error if there is no establishment with this siret
:white_check_mark: returns a reconstructed form if establishment with siret exists with dataSource=form & establishment jwt payload
:white_check_mark: returns a reconstructed form if establishment with siret exists with dataSource=form & IC jwt payload with backoffice rights
:white_check_mark: returns a reconstructed form if establishment with siret exists with dataSource=form & IC jwt payload with user that have same email on establishment contacts

src/domains/establishment/use-cases/SearchImmersion.unit.test.ts [link]
34 passed, 0 failed, 0 todo, done in 0.347 s

:white_check_mark: SearchImmersionUseCase

:white_check_mark: stores searches made
:white_check_mark: searches without geo params

:white_check_mark: gets results for search made without geo params and stores search made
:white_check_mark: gets results for search made with appellations but without geo params
:white_check_mark: gets all results for search made with appellations but no geo params

:white_check_mark: gets all results around if no rome is provided
:white_check_mark: gets both search results and LBB results when multiple appellationCodes
:white_check_mark: gets both search results and LBB results if voluntaryToImmersion is not provided
:white_check_mark: gets only search results if voluntaryToImmersion is true
:white_check_mark: does not crash when LBB returns an error, and provides only search results
:white_check_mark: gets only LBB results if voluntaryToImmersion is false, and do not query results from DB
:white_check_mark: deduplicate results if a company with same siret is both in search results and LBB results
:white_check_mark: stores only the number of search results from our db when searching without specifying voluntary_to_immersion
:white_check_mark: gets only the search results if a company with same siret is also in LBB results even if establishement was previously deleted, than added again
:white_check_mark: return only the establishment that only accept student if estbablishmentSearchableBy params is define to student
:white_check_mark: return only the establishment that only accept student if estbablishmentSearchableBy params is define to jobSeekers
:white_check_mark: return all the establishments if estbablishmentSearchableBy params is not define
:white_check_mark: No result when a company is one internal & LBB results and the company is not searchable

:white_check_mark: should only record number of internal search results
:white_check_mark: Without voluntary to immersion
:white_check_mark: With voluntary to immersion false
:white_check_mark: With voluntary to immersion true

:white_check_mark: No result when a company is deleted & LBB results

:white_check_mark: Without voluntary to immersion
:white_check_mark: With voluntary to immersion false
:white_check_mark: With voluntary to immersion true

:white_check_mark: No result when establishment aggregate next availability is after now

:white_check_mark: Without voluntary to immersion
:white_check_mark: With voluntary to immersion false
:white_check_mark: With voluntary to immersion true

:white_check_mark: handle authentication

:white_check_mark: authenticated with api key

:white_check_mark: Search immersion, and DO NOT provide contact details

:white_check_mark: Not authenticated with api key

:white_check_mark: Search immersion, and do NOT provide contact details

:white_check_mark: repository call optimization

:white_check_mark: does not call discussion & convention repositories when there is no search results
:white_check_mark: does not call discussion & convention repositories when there is search results but not sorted by score

:white_check_mark: scoring capabilities

:white_check_mark: orders search results by score

:white_check_mark: filter FitForDisabledWorkers

:white_check_mark: without filter all establisments
:white_check_mark: with filter false establishments with fitForDisabledWorkers false
:white_check_mark: with filter true establishments with fitForDisabledWorkers true

src/domains/establishment/use-cases/SendBeneficiariesPdfAssessmentsEmails.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.263 s

:white_check_mark: SendBeneficiariesPdfAssessmentsEmails

:white_check_mark: Sends an email to immersions ending tomorrow
:white_check_mark: Doesn't send an email to beneficiary that already received one

src/domains/establishment/use-cases/SendEmailsWithAssessmentCreationLink.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.566 s

:white_check_mark: SendEmailWithAssessmentCreationLink

:white_check_mark: Sends an email to immersions that end yesterday
:white_check_mark: Does not send an email to immersions having already received one

src/domains/establishment/use-cases/SendEstablishmentLeadReminderScript.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.226 s

:white_check_mark: SendEstablishmentLeadReminder

:white_check_mark: Send first reminder

:white_check_mark: Send emails to establishment lead when lastEventKind = 'to-be-reminded

:white_check_mark: Send second reminder

:white_check_mark: Send emails to establishment lead when lastEventKind ='reminder-sent' and only one reminder event sent 7 day ago

src/domains/establishment/use-cases/SuggestEditEstablishment.unit.test.ts [link]
1 passed, 0 failed, 0 todo, done in 0.23 s

:white_check_mark: SuggestEditEstablishment

:white_check_mark: Sends an email to contact and people in copy

src/domains/establishment/use-cases/UpdateEstablishmentAggregateFromFormEstablishement.unit.test.ts [link]
3 passed, 0 failed, 0 todo, done in 3.922 s

:white_check_mark: Update Establishment aggregate from form data

:white_check_mark: Fails if establishment does not exists amongst establishments from form
:white_check_mark: Replaces establishment and offers with same siret, and apply users rights

:white_check_mark: When users already existed
:white_check_mark: When users not exist, create user additionnaly

src/domains/establishment/use-cases/UpdateEstablishmentsFromSireneApiScript.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.164 s

:white_check_mark: Update establishments from Sirene API

:white_check_mark: when there is no establishment which needs an update
:white_check_mark: when there is an establishment which needs an update

:white_check_mark: when insee returns no update

:white_check_mark: establishment has never been updated with insee data
:white_check_mark: establishment has been updated with insee data long ago

:white_check_mark: When insee returns updated data

:white_check_mark: establishment has been updated with insee data long ago
:white_check_mark: updates only number of establishment up to the maximum provided

src/domains/inclusion-connected-users/use-cases/CreateUserForAgency.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.232 s

:white_check_mark: CreateUserForAgency

:white_check_mark: throws Forbidden if token payload is not backoffice token
:white_check_mark: throws not found if agency does not exist
:white_check_mark: Agency with refers to agency

:white_check_mark: Throw when user have role validator

:white_check_mark: create new user with its agency rights if no other users exist by email
:white_check_mark: add agency rights to an existing user with same email
:white_check_mark: throw if user already exist in agency

src/domains/inclusion-connected-users/use-cases/GetInclusionConnectedUser.unit.test.ts [link]
20 passed, 0 failed, 0 todo, done in 0.306 s

:white_check_mark: GetUserAgencyDashboardUrl

:white_check_mark: For getting the current user's data

:white_check_mark: throws NotFoundError if the user is not found
:white_check_mark: throws Forbidden if no user is provided
:white_check_mark: returns the dashboard url

:white_check_mark: when role is 'counsellor'
:white_check_mark: when role is 'validator'
:white_check_mark: when role is 'agency-admin'
:white_check_mark: when role is 'agency-viewer'

:white_check_mark: gets the user without dashboard url

:white_check_mark: for role 'to-review'

:white_check_mark: returns the erroredConventionsDashboardUrl to undefined when agency is not of kind with synchronisation enabled
:white_check_mark: the dashboard url should not include the agency ids where role is 'to-review'
:white_check_mark: establishment dashboards

:white_check_mark: convention

:white_check_mark: retrieve dashboard when IC user is establishement rep in at least one convention
:white_check_mark: retrieve dashboard when IC user is establishement tutor in at least one convention
:white_check_mark: should retrieve dashboard when ic user is establishment representative and tutor for at least one convention
:white_check_mark: do not retrieve dashboard when IC user is not establishement tutor or respresentative in any conventions

:white_check_mark: discussions

:white_check_mark: retrieve dashboard when IC user is establishment contact for at least one discussion
:white_check_mark: retrieves dashboard when IC user is establishment contact copy email of a discussion
:white_check_mark: do not retrieve dashboard when IC user is not establishment contact in any discussion

:white_check_mark: establishments

:white_check_mark: retrieve establishments when IC user is establishement rep in at least one establishment
:white_check_mark: do not retrieve establishment when IC user is not establishment representative in at least one establishment

:white_check_mark: for an admin getting another user's data

:white_check_mark: throws if currentUser is not admin
:white_check_mark: gets another user's data if currentUser is admin

src/domains/inclusion-connected-users/use-cases/GetInclusionConnectedUsers.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.268 s

:white_check_mark: GetInclusionConnectedUsers

:white_check_mark: throws Unauthorized if no jwt token provided
:white_check_mark: throws Forbidden if token payload is not backoffice token
:white_check_mark: gets the users by agencyRole which have at least one agency with the given role
:white_check_mark: gets the users by agencyId which have at least one agency with the given role
:white_check_mark: returns results ordered Alphabetically, people with no name should be first

src/domains/inclusion-connected-users/use-cases/GetUsers.unit.test.ts [link]
2 passed, 0 failed, 0 todo, done in 0.466 s

:white_check_mark: GetUsers

:white_check_mark: throws if user is not admin
:white_check_mark: works for admins

src/domains/inclusion-connected-users/use-cases/LinkFranceTravailUsersToTheirAgencies.unit.test.ts [link]
9 passed, 0 failed, 0 todo, done in 0.233 s

:white_check_mark: LinkFranceTravailUsersToTheirAgencies

:white_check_mark: when no safir code is provided

:white_check_mark: does nothing

:white_check_mark: when safir code is provided

:white_check_mark: add agency right to IC user if user has no rights on agency
:white_check_mark: don't add agency right to IC user if user already has rights on agency
:white_check_mark: replace agency right to IC user if user already has rights on agency and current right is to-review
:white_check_mark: don't add agency right to IC user if there is no agency with this code safir
:white_check_mark: don't add agency right to IC user if agency is closed or rejected

:white_check_mark: when safir code matches agency group

:white_check_mark: adds rights to ic user for all agencies in agency group when safir code matches
:white_check_mark: doesn't override an agency role except if it's to review
:white_check_mark: don't add agency right to IC user if agency is closed or rejected

src/domains/inclusion-connected-users/use-cases/RejectIcUserForAgency.unit.test.ts [link]
5 passed, 0 failed, 0 todo, done in 0.24 s

:white_check_mark: reject IcUser for agency

:white_check_mark: throws when no jwt token provided
:white_check_mark: Throws if current user is not a backoffice admin
:white_check_mark: Throw when no icUser were found
:white_check_mark: Throw when no agency were found
:white_check_mark: Remove agency right for IcUser

src/domains/inclusion-connected-users/use-cases/RemoveUserFromAgency.unit.test.ts [link]
8 passed, 0 failed, 0 todo, done in 0.279 s

:white_check_mark: RemoveUserFromAgency

:white_check_mark: Wrong paths

:white_check_mark: throws forbidden when token payload is not backoffice token
:white_check_mark: throws notFound if user to delete not found
:white_check_mark: throws bad request if user attempts to delete validator when agency has refersTo
:white_check_mark: throws forbidden if user to delete has not rights on agency
:white_check_mark: throws forbidden if user to delete is the last validator receiving notifications
:white_check_mark: throws forbidden if user to delete is the last pre-validator receiving notifications, and agency has other pre-validators
:white_check_mark: throws forbidden if user to delete is the last counsellor receiving notifications on agency with refers to another agency

:white_check_mark: user to delete has right on agency

:white_check_mark: remove user from agency

src/domains/inclusion-connected-users/use-cases/UpdateUserForAgency.unit.test.ts [link]
26 passed, 0 failed, 0 todo, done in 0.384 s

:white_check_mark: UpdateUserForAgency

:white_check_mark: Wrong paths

:white_check_mark: throws Forbidden if no jwt payload provided
:white_check_mark: throws Forbidden if token payload is user has no right on agency
:white_check_mark: throws not found if agency does not exist
:white_check_mark: throws forbidden if user has no rights on agency
:white_check_mark: throws forbidden if user who isn't IF admin or agency admin attempts to update another user email

:white_check_mark: when updating email

:white_check_mark: throws forbidden if attemps modify email of an inclusion connect user
:white_check_mark: does not modify email if it hasn't changed
:white_check_mark: backoffice-admin can update the user email for a non ic user
:white_check_mark: agency-admin can update the user email for a non ic user

:white_check_mark: when roles are updated

:white_check_mark: can change to more than one role
:white_check_mark: should save IcUserAgencyRightChanged event when successful
:white_check_mark: backoffice-admin can changes the role and email notification of a user for a given agency
:white_check_mark: agency-admin can changes the role of a user for a given agency
:white_check_mark: cannot remove the last validator receiving notifications of an agency

:white_check_mark: when last validator role is updated to counsellor
:white_check_mark: when last validator role is not notified by email

:white_check_mark: when counsellor role

:white_check_mark: is added

:white_check_mark: throw an error if not notified by email and no other user of same agency is counsellor notified by email

:white_check_mark: is updated

:white_check_mark: throw when trying to remove notifications from last counsellor receiving notifications
:white_check_mark: can update remove notifications from a counsellor receiving notifications (not the last one)

:white_check_mark: is removed

:white_check_mark: can remove counsellor if no other
:white_check_mark: throw error if not notified and there are other counsellor but none is notified by email

:white_check_mark: cannot remove the last counsellor receiving notifications of an agency with refersTo

:white_check_mark: when last counsellor role is updated to validator
:white_check_mark: when last counsellor role is not notified by email
:white_check_mark: Throw an error when trying to update user Role to counsellor when agency is only one step validation

:white_check_mark: when isNotifiedByEmail is updated

:white_check_mark: backoffice-admin can update isNotifiedByEmail for another user
:white_check_mark: agency-admin can update isNotifiedByEmail for another user
:white_check_mark: user can update its own isNotifiedByEmail

src/domains/marketing/use-cases/UpdateMarketingEstablishmentContactsList.unit.test.ts [link]
11 passed, 0 failed, 0 todo, done in 0.301 s

:white_check_mark: UpdateMarketingEstablishmentContactsList

:white_check_mark: With Establishment in repo

:white_check_mark: Add establishment marketting contact when establishment exist in repo but not in marketting contact list
:white_check_mark: Update establishment marketing contact when establishment exist in repo and in marketting contact list
:white_check_mark: Update convention related properties

:white_check_mark: Doesn't update marketting contact convention related properties if no convention were found and establishment in repo
:white_check_mark: Update convention related properties without contact infos if conventions were found and establishment in repo

:white_check_mark: Update has ic user property when establishment in repo
:white_check_mark: Update discussion related property
:white_check_mark: on missing user in repo
:white_check_mark: on missing establishment admin right

:white_check_mark: Without Establishment in repo

:white_check_mark: Add contact property & convention related properties of establishment marketing contact when convention were found
:white_check_mark: Update contact property & convention related properties of establishment marketing contact when convention were found
:white_check_mark: Remove establishment marketing if no convention were found

src/utils/textSearch.unit.test.ts [link]
6 passed, 0 failed, 0 todo, done in 0.21 s

:white_check_mark: normalize

:white_check_mark: removes accents
:white_check_mark: converts to lower case

:white_check_mark: findMatchRanges

:white_check_mark: single term matches
:white_check_mark: multiple term matches
:white_check_mark: normalized matches
:white_check_mark: order results by startIndexInclusive

Test markdown sections

# Section A
  La section A

## Section A.B
    La section A.B avec le sous titre A.B.C

### Section A.B.C
      On est bien dans A.B.C

#### Section A.B.C.D
        Done!

Exemple de récap / trad en partant du report des tests unitaires donnés par Benjamin et filé à ChatGPT :

Gestion des agences
Ajout d’une agence
Les agences sont ajoutées correctement, avec vérification des emails et des droits administratifs.
Échecs possibles : adresses incomplètes, coordonnées invalides, ou conflit avec des agences existantes.

Filtrage des agences
Permet de lister les agences selon divers critères :
    Type d'agence (par exemple, mini-stage ou immersion professionnelle).
    Département, nom, ou statut de l'agence (succès).

Mise à jour d’une agence
Les mises à jour respectent les droits d’accès des utilisateurs.
Échecs possibles : utilisateur non autorisé, agence inexistante ou informations invalides.

Statut des agences
Les statuts des agences sont mis à jour et des notifications sont envoyées automatiquement si nécessaire.

Lien avec des utilisateurs
Les utilisateurs peuvent être reliés à une agence en vérifiant leurs droits.
Échecs possibles : utilisateur ou agence introuvable, ou droits déjà attribués.

Juste histoire de dire, il y a peut être d'autres outils à envisager qui pourrait nous aider sur ce sujet.