Skip to content

Commit

Permalink
test: corrige tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurlbrjc committed Dec 9, 2024
1 parent 7e1f25d commit e3306b7
Show file tree
Hide file tree
Showing 39 changed files with 94 additions and 91 deletions.
2 changes: 2 additions & 0 deletions tests/components/ChatContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from 'fixtures/beneficiaire'
import { desListesDeDiffusion } from 'fixtures/listes-de-diffusion'
import { BaseBeneficiaire, BeneficiaireEtChat } from 'interfaces/beneficiaire'
import { getConseillersDuJeuneClientSide } from 'services/beneficiaires.service'
import { getListesDeDiffusionClientSide } from 'services/listes-de-diffusion.service'
import { getMessageImportant } from 'services/messages.service'
import renderWithContexts from 'tests/renderWithContexts'
Expand All @@ -32,6 +33,7 @@ describe('<ChatContainer />', () => {
let beneficiairesChats: BeneficiaireEtChat[]

beforeEach(async () => {
;(getConseillersDuJeuneClientSide as jest.Mock).mockResolvedValue([])
;(getListesDeDiffusionClientSide as jest.Mock).mockResolvedValue(
desListesDeDiffusion()
)
Expand Down
11 changes: 4 additions & 7 deletions tests/components/ChatRoom.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,7 @@ describe('<ChatRoom />', () => {
onAccesConversation={accederConversation}
onAccesListesDiffusion={() => {}}
onOuvertureMenu={() => {}}
/>,
{}
/>
))
})
})
Expand All @@ -394,7 +393,7 @@ describe('<ChatRoom />', () => {
it('affiche les alertes sur petit écran', () => {
expect(AlerteDisplayer).toHaveBeenCalledWith(
{ hideOnLargeScreen: true },
{}
undefined
)
})

Expand Down Expand Up @@ -471,8 +470,7 @@ describe('<ChatRoom />', () => {
onAccesConversation={() => {}}
onAccesListesDiffusion={() => {}}
onOuvertureMenu={() => {}}
/>,
{}
/>
))
})

Expand Down Expand Up @@ -501,8 +499,7 @@ describe('<ChatRoom />', () => {
onAccesConversation={() => {}}
onAccesListesDiffusion={() => {}}
onOuvertureMenu={() => {}}
/>,
{}
/>
)

// When
Expand Down
2 changes: 1 addition & 1 deletion tests/pages/CloturePage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('CloturePage server side', () => {
}),
returnTo: '/mes-jeunes/edition-rdv?idRdv=1&redirectUrl=redirectUrl',
},
{}
undefined
)
})

Expand Down
2 changes: 1 addition & 1 deletion tests/pages/ClotureSessionPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Cloture Session server side', () => {
inscriptionsInitiales: inscriptionsInitiales,
returnTo: `/agenda/sessions/session-1?redirectUrl=redirectUrl`,
},
{}
undefined
)
})

Expand Down
7 changes: 5 additions & 2 deletions tests/pages/ConsentementCguPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('ConsentementCGUPage server side', () => {
expect(metadata).toEqual({ title: 'Consentement CGU' })
expect(ConsentementCguPage).toHaveBeenCalledWith(
{ returnTo: '/?onboarding=true' },
{}
undefined
)
})

Expand All @@ -47,6 +47,9 @@ describe('ConsentementCGUPage server side', () => {

// Then
expect(metadata).toEqual({ title: 'Consentement CGU' })
expect(ConsentementCguPage).toHaveBeenCalledWith({ returnTo: '/?' }, {})
expect(ConsentementCguPage).toHaveBeenCalledWith(
{ returnTo: '/?' },
undefined
)
})
})
4 changes: 2 additions & 2 deletions tests/pages/DetailActionPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('ActionPage server side', () => {
lectureSeule: false,
from: 'beneficiaire',
},
{}
undefined
)
})

Expand Down Expand Up @@ -123,7 +123,7 @@ describe('ActionPage server side', () => {
lectureSeule: false,
from: 'pilotage',
},
{}
undefined
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/pages/DetailDemarchePage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('DetailDemarchePage server side', () => {
demarche,
lectureSeule: false,
},
{}
undefined
)
})

Expand Down
2 changes: 1 addition & 1 deletion tests/pages/DetailsSessionPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('Détails Session Page Server', () => {
session: session,
returnTo: 'redirectUrl',
},
{}
undefined
)
})
})
Expand Down
4 changes: 2 additions & 2 deletions tests/pages/EditionListeDiffusionPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Page d’édition d’une liste de diffusion', () => {
{
returnTo: '/mes-jeunes/listes-de-diffusion',
},
{}
undefined
)
})

Expand Down Expand Up @@ -73,7 +73,7 @@ describe('Page d’édition d’une liste de diffusion', () => {
liste: listeDeDiffusion,
returnTo: '/mes-jeunes/listes-de-diffusion',
},
{}
undefined
)
})
})
4 changes: 2 additions & 2 deletions tests/pages/EmargementRdvPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('EmargementRdvPage server side', () => {
evenement: acAEmarger,
agence: 'Montastruc-la-Conseillère',
},
{}
undefined
)
})
})
Expand Down Expand Up @@ -102,7 +102,7 @@ describe('EmargementRdvPage server side', () => {
evenement: sessionAEmarger,
agence: 'Montastruc-la-Conseillère',
},
{}
undefined
)
})
})
Expand Down
4 changes: 2 additions & 2 deletions tests/pages/EnvoiMessageGroupePage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('EnvoiMessageGroupePage server side', () => {
listesDiffusion: listesDeDiffusion,
returnTo: 'http://localhost:3000/agenda',
},
{}
undefined
)
})

Expand All @@ -83,7 +83,7 @@ describe('EnvoiMessageGroupePage server side', () => {
listesDiffusion: listesDeDiffusion,
returnTo: '/mes-jeunes',
},
{}
undefined
)
})
})
4 changes: 2 additions & 2 deletions tests/pages/EtablissementPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('EtablissementPage server side', () => {

// Then

expect(EtablissementPage).toHaveBeenCalledWith({}, {})
expect(EtablissementPage).toHaveBeenCalledWith({}, undefined)
})

it('prépare la page en tant que MILO', async () => {
Expand All @@ -53,7 +53,7 @@ describe('EtablissementPage server side', () => {

// Then

expect(EtablissementPage).toHaveBeenCalledWith({}, {})
expect(EtablissementPage).toHaveBeenCalledWith({}, undefined)
})
})
})
2 changes: 1 addition & 1 deletion tests/pages/FavorisPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Favoris', () => {
recherches,
lectureSeule: false,
},
{}
undefined
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/pages/HistoriquePage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('HistoriquePage server side', () => {
beneficiaire: detailBeneficiaire,
onglet: 'INFORMATIONS',
},
{}
undefined
)
})
})
8 changes: 4 additions & 4 deletions tests/pages/HomePage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('HomePage server side', () => {
afficherModaleOnboarding: false,
redirectUrl: '/mes-jeunes',
},
{}
undefined
)
})
})
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('HomePage server side', () => {
redirectUrl: '/agenda',
referentielAgences: uneListeDAgencesFranceTravail(),
},
{}
undefined
)
})
})
Expand Down Expand Up @@ -150,7 +150,7 @@ describe('HomePage server side', () => {
redirectUrl: '/mes-jeunes',
referentielAgences: undefined,
},
{}
undefined
)
})
})
Expand Down Expand Up @@ -184,7 +184,7 @@ describe('HomePage server side', () => {
redirectUrl: '/agenda',
referentielAgences: uneListeDAgencesFranceTravail(),
},
{}
undefined
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/pages/ListesDiffusionPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Page Listes de Diffusion', () => {
{
listesDiffusion: desListesDeDiffusion(),
},
{}
undefined
)
})
})
2 changes: 1 addition & 1 deletion tests/pages/LoginCEJPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ describe('LoginCEJPage server side', () => {
title:
"Connexion dans l'espace conseiller - Outil du Contrat d’Engagement Jeune",
})
expect(LoginCEJPage).toHaveBeenCalledWith({}, {})
expect(LoginCEJPage).toHaveBeenCalledWith({}, undefined)
})
})
2 changes: 1 addition & 1 deletion tests/pages/LoginHubPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ describe('LoginPage server side', () => {
title:
'Sélection de l’espace de connexion - Outil du Contrat d’Engagement Jeune et du pass emploi',
})
expect(LoginHubPage).toHaveBeenCalledWith({}, {})
expect(LoginHubPage).toHaveBeenCalledWith({}, undefined)
})
})
2 changes: 1 addition & 1 deletion tests/pages/LoginPassEmploiPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('LoginPassEmploiPage server side', () => {
})
expect(LoginPassEmploiPage).toHaveBeenCalledWith(
{ ssoAvenirProEstActif: true },
{}
undefined
)
})
})
4 changes: 2 additions & 2 deletions tests/pages/LogoutPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('LogoutPage server side', () => {
render(await Logout())

// Then
expect(LogoutPage).toHaveBeenCalledWith({ callbackUrl: '/login/cej' }, {})
expect(LogoutPage).toHaveBeenCalledWith({ callbackUrl: '/login/cej' }, undefined)
})
})

Expand All @@ -36,7 +36,7 @@ describe('LogoutPage server side', () => {
// Then
expect(LogoutPage).toHaveBeenCalledWith(
{ callbackUrl: '/login/passemploi' },
{}
undefined
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion tests/pages/ModificationActionPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('ModificationActionPage server side', () => {
'/mes-jeunes/beneficiaire-1/actions/id-action-1'
),
},
{}
undefined
)
})

Expand Down
2 changes: 1 addition & 1 deletion tests/pages/NouvelleActionPage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('NouvelleActionPage server side', () => {
],
returnTo: '/mes-jeunes/id-beneficiaire?onglet=actions',
},
{}
undefined
)
})
})
6 changes: 3 additions & 3 deletions tests/pages/OffrePage.server.page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('OffrePage server side', () => {
{
offre: detailEmploi,
},
{}
undefined
)
})

Expand Down Expand Up @@ -102,7 +102,7 @@ describe('OffrePage server side', () => {
{
offre: detailImmersion,
},
{}
undefined
)
})

Expand Down Expand Up @@ -151,7 +151,7 @@ describe('OffrePage server side', () => {
{
offre: detailServiceCivique,
},
{}
undefined
)
})

Expand Down
8 changes: 4 additions & 4 deletions tests/pages/PartageOffrePage.server.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Page Partage Offre', () => {
offre: offreEmploi,
returnTo: 'referer-url',
},
{}
undefined
)
})

Expand All @@ -102,7 +102,7 @@ describe('Page Partage Offre', () => {
offre: serviceCivique,
returnTo: 'referer-url',
},
{}
undefined
)
})

Expand All @@ -127,7 +127,7 @@ describe('Page Partage Offre', () => {
offre: immersion,
returnTo: 'referer-url',
},
{}
undefined
)
})

Expand Down Expand Up @@ -168,7 +168,7 @@ describe('Page Partage Offre', () => {
expect.objectContaining({
returnTo: '/offres',
}),
{}
undefined
)
})
})
Loading

0 comments on commit e3306b7

Please sign in to comment.