Skip to content

Commit

Permalink
Feature-flippe la route de création de session
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabinout committed May 16, 2024
1 parent 8e2fe32 commit d89faef
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/routes/routesAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,21 @@ const routesAuth = (config) => {
)
));

routes.get('/fcplus/creationSession', (requete, reponse) => (
creationSessionFCPlus(
{
adaptateurChiffrement,
adaptateurEnvironnement,
adaptateurFranceConnectPlus,
},
requete,
reponse,
)
));
routes.get('/fcplus/creationSession', (requete, reponse) => {
if (adaptateurEnvironnement.avecConnexionFCPlus()) {
creationSessionFCPlus(
{
adaptateurChiffrement,
adaptateurEnvironnement,
adaptateurFranceConnectPlus,
},
requete,
reponse,
);
} else {
reponse.status(501).send('Not Implemented Yet!');
}
});

return routes;
};
Expand Down
11 changes: 11 additions & 0 deletions test/routes/routesAuth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,16 @@ describe('Le serveur des routes `/auth`', () => {

return verifieRedirection(`http://localhost:${port}/auth/fcplus/creationSession`, `http://localhost:${port}/redirectionConnexion`);
});

it('retourne une erreur 501 si le feature-flipping est désactivé', () => {
expect.assertions(1);

serveur.adaptateurEnvironnement().avecConnexionFCPlus = () => false;

return axios.get(`http://localhost:${port}/auth/fcplus/creationSession`)
.catch(({ response }) => {
expect(response.status).toEqual(501);
});
});
});
});

0 comments on commit d89faef

Please sign in to comment.