-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TESTS][DEVENIR AIDANT] Vérifie l'action HATEOAS de finalisation-crea…
…tion-nouvel-espace-aidant après le 31 janvier
- Loading branch information
Showing
5 changed files
with
82 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,57 @@ | ||
import { describe, it } from 'vitest'; | ||
import { lesContextesUtilisateursExistants } from './lesContextesUtilisateursExistants'; | ||
import { beforeAll, describe, it } from 'vitest'; | ||
import { | ||
lesContextesUtilisateursExistants, | ||
lesContextesUtilisateursNouveauParcoursExistants, | ||
} from './lesContextesUtilisateursExistants'; | ||
import { constructeurActionsHATEOAS } from '../../../src/api/hateoas/hateoas'; | ||
import { InformationsContexte } from '../../../src/adaptateurs/AdaptateurDeVerificationDeSession'; | ||
import { adaptateurEnvironnement } from '../../../src/adaptateurs/adaptateurEnvironnement'; | ||
import { FournisseurHorlogeDeTest } from '../../infrastructure/horloge/FournisseurHorlogeDeTest'; | ||
|
||
describe('HATEOAS', () => { | ||
it.each(lesContextesUtilisateursExistants)( | ||
'Retourne les liens correspondant au contexte $contexte', | ||
(contexte) => { | ||
const reponseHATEOAS = constructeurActionsHATEOAS() | ||
.pour(contexte.informationContexte as InformationsContexte) | ||
.construis(); | ||
describe('Avant nouveau parcours', () => { | ||
beforeAll(() => { | ||
adaptateurEnvironnement.nouveauParcoursDevenirAidant = () => | ||
'2025-01-31T08:00:00'; | ||
FournisseurHorlogeDeTest.initialise( | ||
new Date(Date.parse('2025-01-14T08:00:00')) | ||
); | ||
}); | ||
|
||
expect(reponseHATEOAS).toStrictEqual({ | ||
liens: { ...contexte.liens }, | ||
}); | ||
} | ||
); | ||
it.each(lesContextesUtilisateursExistants)( | ||
'Retourne les liens correspondant au contexte $contexte', | ||
(contexte) => { | ||
const reponseHATEOAS = constructeurActionsHATEOAS() | ||
.pour(contexte.informationContexte as InformationsContexte) | ||
.construis(); | ||
|
||
expect(reponseHATEOAS).toStrictEqual({ | ||
liens: { ...contexte.liens }, | ||
}); | ||
} | ||
); | ||
}); | ||
|
||
describe('Nouveau parcours', async () => { | ||
beforeEach(async () => { | ||
adaptateurEnvironnement.nouveauParcoursDevenirAidant = () => | ||
'2025-01-31T08:00:00'; | ||
FournisseurHorlogeDeTest.initialise( | ||
new Date(Date.parse('2025-02-02T08:00:00')) | ||
); | ||
}); | ||
|
||
it.each(lesContextesUtilisateursNouveauParcoursExistants)( | ||
'Retourne les liens correspondant au contexte $contexte', | ||
(contexte) => { | ||
const reponseHATEOAS = constructeurActionsHATEOAS() | ||
.pour(contexte.informationContexte as InformationsContexte) | ||
.construis(); | ||
|
||
expect(reponseHATEOAS).toStrictEqual({ | ||
liens: { ...contexte.liens }, | ||
}); | ||
} | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters