Skip to content

Commit

Permalink
Merge pull request #1361 from SocialGouv/fix/us-2632-rafraichissement…
Browse files Browse the repository at this point in the history
…-des-donnees-sur-sessions-ac

feat(us-2632): rafraichissement-des-donnees-sur-sessions
  • Loading branch information
octo-theg authored Jun 5, 2024
2 parents 2cb5bb2 + 3123653 commit e01ed28
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ function DetailsSessionPage({
)
setTrackingLabel(initialTracking + ' - Modification succès')
router.push(returnTo)
router.refresh()
}

function trackEmargement() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ function ClotureSessionPage({
setAlerte(AlerteParam.clotureSession)
setTrackingLabel('Session - Clôture succès')
router.push(returnTo)
router.refresh()
}

function afficherStatut(beneficiaire: InformationBeneficiaireSession) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function CloturePage({ returnTo, evenement }: ClotureProps) {

setAlerte(AlerteParam.clotureAC)
router.push(returnTo)
router.refresh()
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function EditionRdvPage({
await modifierEvenement(evenement.id, payload)
}
router.push(returnTo)
router.refresh()
}

async function creerNouvelEvenement(
Expand Down
3 changes: 3 additions & 0 deletions components/pilotage/OngletActionsPilotage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useRouter } from 'next/navigation'
import React, { useState } from 'react'

import IllustrationComponent, {
Expand Down Expand Up @@ -37,6 +38,7 @@ export default function OngletActionsPilotage({
getActions,
onLienExterne,
}: OngletActionsPilotageProps) {
const router = useRouter()
const [_, setAlerte] = useAlerte()
const [actions, setActions] = useState<ActionPilotage[]>(actionsInitiales)
const [actionsFiltrees, setActionsFitrees] =
Expand Down Expand Up @@ -124,6 +126,7 @@ export default function OngletActionsPilotage({

setActions(nouvellesActions)
setActionsFitrees(nouvellesActions)
router.refresh()
} catch (error) {
setErreurQualification(
error instanceof ApiError && error.statusCode !== 500
Expand Down
3 changes: 3 additions & 0 deletions tests/pages/CloturePage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ describe('CloturePage client side', () => {

let alerteSetter: (key: AlerteParam | undefined, target?: string) => void
let routerPush: Function
let routerRefresh: Function
beforeEach(async () => {
// Given
alerteSetter = jest.fn()
routerPush = jest.fn()
routerRefresh = jest.fn()
;(useRouter as jest.Mock).mockReturnValue({
push: routerPush,
refresh: routerRefresh,
})

// When
Expand Down
3 changes: 3 additions & 0 deletions tests/pages/ClotureSessionPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ describe('Cloture Session', () => {

let alerteSetter: (key: AlerteParam | undefined, target?: string) => void
let routerPush: jest.Mock
let routerRefresh: jest.Mock

beforeEach(async () => {
alerteSetter = jest.fn()
routerPush = jest.fn()
routerRefresh = jest.fn()
;(useRouter as jest.Mock).mockReturnValue({
push: routerPush,
refresh: routerRefresh,
})

// When
Expand Down
12 changes: 8 additions & 4 deletions tests/pages/DetailsSessionPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,12 @@ describe('Détails Session Page Client', () => {
describe('au clic sur le bouton d’enregistrement', () => {
it('appelle la méthode changerInscriptionsSession', async () => {
//Given
let routerPush: Function = jest.fn()
let push: Function = jest.fn()
let refresh: Function = jest.fn()

;(useRouter as jest.Mock).mockReturnValue({
push: routerPush,
push,
refresh,
})
;(changerInscriptionsSession as jest.Mock).mockResolvedValue(undefined)
session = unDetailSession({
Expand Down Expand Up @@ -866,10 +868,12 @@ describe('Détails Session Page Client', () => {

it('au clic sur le bouton de réinscription, change le statut du bénéficiaire', async () => {
//Given
let routerPush: Function = jest.fn()
let push: Function = jest.fn()
let refresh: Function = jest.fn()

;(useRouter as jest.Mock).mockReturnValue({
push: routerPush,
push,
refresh,
})
;(changerInscriptionsSession as jest.Mock).mockResolvedValue(undefined)

Expand Down
9 changes: 7 additions & 2 deletions tests/pages/edition-rdv/EditionRdvPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ describe('EditionRdvPage client side', () => {

let alerteSetter: (key: AlerteParam | undefined, target?: string) => void
let push: Function
let refresh: jest.Mock

beforeEach(() => {
jeunesConseiller = desItemsJeunes()
jeunesAutreConseiller = [
Expand Down Expand Up @@ -67,7 +69,8 @@ describe('EditionRdvPage client side', () => {

alerteSetter = jest.fn()
push = jest.fn(() => Promise.resolve())
;(useRouter as jest.Mock).mockReturnValue({ push })
refresh = jest.fn()
;(useRouter as jest.Mock).mockReturnValue({ push, refresh })
})

describe('contenu', () => {
Expand Down Expand Up @@ -1323,6 +1326,7 @@ describe('EditionRdvPage client side', () => {

let alerteSetter: (key: AlerteParam | undefined, target?: string) => void
let push: Function
let refresh: jest.Mock
beforeEach(() => {
jeunesConseiller = desItemsJeunes()
jeunesAutreConseiller = [
Expand Down Expand Up @@ -1350,7 +1354,8 @@ describe('EditionRdvPage client side', () => {

alerteSetter = jest.fn()
push = jest.fn(() => Promise.resolve())
;(useRouter as jest.Mock).mockReturnValue({ push })
refresh = jest.fn()
;(useRouter as jest.Mock).mockReturnValue({ push, refresh })
})

describe('quand on veut créer une animation collective', () => {
Expand Down

0 comments on commit e01ed28

Please sign in to comment.