Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: e2e for idcc #1488

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clients/recherche-entreprise/idcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { httpGet } from '#utils/network';
export const clientIdccRechercheEntreprise = async (
siren: Siren
): Promise<IConventionsCollectives> => {
const url = `${routes.rechercheEntreprise.idcc.siren}/${siren}`;
const url = routes.rechercheEntreprise.idcc.getBySiren(siren);
const data = await httpGet<IConventionsCollectives>(url, {});

return data;
Expand Down
3 changes: 2 additions & 1 deletion clients/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ const routes = {
rechercheUniteLegale: 'https://recherche-entreprises.api.gouv.fr/search',
idcc: {
metadata: 'https://recherche-entreprises.api.gouv.fr/idcc/metadata',
siren: 'https://recherche-entreprises.api.gouv.fr/idcc',
getBySiren: (siren: string) =>
`https://recherche-entreprises.api.gouv.fr/idcc/${siren}`,
},
lastModified:
'https://recherche-entreprises.api.gouv.fr/sources/last_modified',
Expand Down
13 changes: 13 additions & 0 deletions cypress/e2e/conventions-collectives.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
describe('Conventions supprimées', () => {
it('Should work for valid companies', () => {
cy.visit('/divers/356000000');
cy.contains("Convention d'entreprise La Poste - France Télécom");
});

// Need an example
// it('Should display Inconnues ou supprimées', () => {
// cy.visit('/divers/592052302');
// cy.contains('Inconnues ou supprimées');
// cy.contains('et remplacée par :');
// });
});
12 changes: 0 additions & 12 deletions cypress/e2e/conventions-collectives.js

This file was deleted.

12 changes: 12 additions & 0 deletions cypress/fixtures/recherche-entreprise-idcc-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"5516": {
"titre de la convention": "Convention d'entreprise La Poste - France Télécom",
"id_kali": null,
"cc_ti": null,
"nature": null,
"etat": null,
"debut": null,
"fin": null,
"url": null
}
}
3 changes: 3 additions & 0 deletions cypress/fixtures/recherche-entreprise-idcc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"5516": ["35600000053008", "35600000016414"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { HttpResponse, HttpResponseResolver } from 'msw';
import rechercheEntrepriseIdccMetadata from '../../fixtures/recherche-entreprise-idcc-metadata.json';

export const rechercheEntrepriseIdccMetadataHandler: HttpResponseResolver =
async ({ request }) => {
return HttpResponse.json(rechercheEntrepriseIdccMetadata);
};
8 changes: 8 additions & 0 deletions cypress/mocks/handlers/recherche-entreprises-idcc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { HttpResponse, HttpResponseResolver } from 'msw';
import rechercheEntrepriseIdcc from '../../fixtures/recherche-entreprise-idcc.json';

export const rechercheEntrepriseIdccHandler: HttpResponseResolver = async ({
request,
}) => {
return HttpResponse.json(rechercheEntrepriseIdcc);
};
10 changes: 10 additions & 0 deletions cypress/mocks/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import { igHandler } from './handlers/ig';
import { journalOfficielAssociationsHandler } from './handlers/journal-officiel-associations';
import { odsMetadataHandler } from './handlers/ods-metadata';
import { rechercheEntrepriseHandler } from './handlers/recherche-entreprises';
import { rechercheEntrepriseIdccHandler } from './handlers/recherche-entreprises-idcc';
import { rechercheEntrepriseIdccMetadataHandler } from './handlers/recherche-entreprises-idcc-metadata';
import { rgeHandler } from './handlers/rge';
import { rneDefaultHandler, rneFallbackHandler } from './handlers/rne';
import { tvaHandler } from './handlers/tva';
Expand All @@ -48,6 +50,14 @@ export const routesHandlers = [
routes.rechercheEntreprise.rechercheUniteLegale,
rechercheEntrepriseHandler
),
http.get(
routes.rechercheEntreprise.idcc.metadata,
rechercheEntrepriseIdccMetadataHandler
),
http.get(
routes.rechercheEntreprise.idcc.getBySiren(':siren'),
rechercheEntrepriseIdccHandler
),
http.get(routes.certifications.rge.api, rgeHandler),
http.get(routes.certifications.bio.api, apiBioHandler),
http.get(
Expand Down
Loading