Skip to content

Commit

Permalink
Merge pull request #956 from MTES-MCT/main
Browse files Browse the repository at this point in the history
Mise en production 09/10/2024
  • Loading branch information
loicguillois authored Oct 9, 2024
2 parents 35bd93a + c551bdf commit 61e9458
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 39 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ env:
MAILER_PORT: ${{ secrets.MAILER_PORT }}
MAILER_USER: ${{ secrets.MAILER_USER }}
MAILER_PASSWORD: ${{ secrets.MAILER_PASSWORD }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}

jobs:
deploy-addons:
Expand Down Expand Up @@ -90,6 +91,8 @@ jobs:
clever env set CC_PRE_RUN_HOOK 'corepack yarn workspace $WORKSPACE migrate && corepack yarn workspace $WORKSPACE seed' -a $APP_ALIAS
clever env set CEREMA_API "https://api.cerema.fr" -a $APP_ALIAS
clever env set CEREMA_ENABLED "false" -a $APP_ALIAS
clever env set CEREMA_USERNAME "unused" -a $APP_ALIAS
clever env set CEREMA_PASSWORD "unused" -a $APP_ALIAS
clever env set DATABASE_ENV "development" -a $APP_ALIAS
clever env set DATABASE_URL $POSTGRESQL_ADDON_URI -a $APP_ALIAS
clever env set E2E_EMAIL $E2E_EMAIL -a $APP_ALIAS
Expand All @@ -110,6 +113,7 @@ jobs:
clever env set MAILER_USER $MAILER_USER -a $APP_ALIAS
clever env set MAILER_PASSWORD $MAILER_PASSWORD -a $APP_ALIAS
clever env set MAILER_PROVIDER "nodemailer" -a $APP_ALIAS
clever env set TEST_PASSWORD $TEST_PASSWORD -a $APP_ALIAS
- name: Scale up for deployment
run: clever scale --flavor M -a $APP_ALIAS
Expand Down
16 changes: 11 additions & 5 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
fileignoreconfig:
- filename: .github/workflows/review-app.yml
checksum: 00550719490eeb392f0f211567c3e55b50a1512fd25218e8d8bdd349a769649a
checksum: f7719ba0d36160d97e80ee15cb5415b601354576929e36df0596c7d192465cfb
- filename: README.md
checksum: df312ccb4c75fc4c2441a1f7f2c7817ee98ffb3065c78d5d7d6addf6ab129176
- filename: frontend/src/components/Draft/DraftSender.tsx
checksum: cfcc1023edac4d29c305f00a4bd86f27d491e4e9535bec2bd905a917b3f396b7
- filename: frontend/src/index.tsx
checksum: 25a58ba4ecfb8606daf5efbae6a1f0f2efe4e87a4a8a18e745712b39198d93a5
- filename: server/.env.example
checksum: 4955533b2ba29ebc4a052e65ce2aab5b911ebf8e4b4eeecff50b5e83d1857c35
- filename: frontend/src/components/Draft/DraftSender.tsx
checksum: cfcc1023edac4d29c305f00a4bd86f27d491e4e9535bec2bd905a917b3f396b7
- filename: server/src/infra/database/seeds/development/20240404235457_users.ts
checksum: 459ad7c52a09b1a5d885f0e13acd68a894b862470125529ecc28a4116c737df7
- filename: server/src/services/ceremaService/ceremaService.ts
checksum: 2005ee48d86de2c6e6e57b187862cdeaafcb9f0c49e9a82ec7031910957174e8
- filename: frontend/src/index.tsx
checksum: 25a58ba4ecfb8606daf5efbae6a1f0f2efe4e87a4a8a18e745712b39198d93a5
scopeconfig:
- scope: node
allowed_patterns:
- keyof
- \[key\]
- key=
version: "1.0"
7a4a8a18e745712b39198d93a5
scopeconfig:
- scope: node
allowed_patterns:
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@types/node": "^20.16.10",
"@types/prop-types": "^15.7.13",
"@types/randomstring": "^1.3.0",
"@types/react": "^18.3.10",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",
"@types/uuid": "^9.0.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ const FillLocalId = forwardRef((props: StepProps, ref) => {
>
L’identifiant du logement
</a>
&nbsp;est une concaténation du
&nbsp;est une concaténation du&nbsp;
<a
href="https://doc-datafoncier.cerema.fr/doc/dv3f/local/coddep"
target="_blank"
rel="noreferrer"
>
code département
&nbsp;code département
</a>
&nbsp;du logement et de
&nbsp;du logement et de&nbsp;
<a
href="https://doc-datafoncier.cerema.fr/doc/ff/pb0010_local/invar"
target="_blank"
Expand Down
17 changes: 9 additions & 8 deletions frontend/src/mocks/handlers/housing-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ type HousingPayload = {
};

export const housingHandlers: RequestHandler[] = [
http.post<Record<string, never>, HousingPayload, Paginated<HousingDTO>>(
http.get<Record<string, never>, HousingPayload, Paginated<HousingDTO>>(
`${config.apiEndpoint}/api/housing`,
async ({ request }) => {
// TODO: use the request payload to filter results
const payload = await request.json();
const url = new URL(request.url);
const queryParams = url.searchParams;
const filters = queryParams.get('filters') ? JSON.parse(queryParams.get('filters') as string) : null;

const subset = fp.pipe(
filterByCampaign(payload.filters?.campaignIds),
filterByHousingKind(payload.filters?.housingKinds),
filterByCampaign(filters?.campaignIds),
filterByHousingKind(filters?.housingKinds),
filterByStatus(
payload.filters?.status
? [payload.filters.status]
: payload.filters?.statusList
filters?.status
? [filters.status]
: filters?.statusList
)
)(data.housings);

Expand Down
40 changes: 20 additions & 20 deletions frontend/src/views/Campaign/test/CampaignView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ describe('Campaign view', () => {
await screen.findByRole('heading', { name: title });
});

it('should confirm a recipient removal', async () => {
renderComponent();

const tab = await screen.findByRole('tab', { name: /^Destinataires/ });
await user.click(tab);
const rowsBefore = screen.getAllByRole('row').slice(1); // Remove headers
expect(rowsBefore).toHaveLength(housings.length);
const row = rowsBefore[rowsBefore.length - 1];
const remove = within(row).getByTitle(/^Supprimer le propriétaire/);
await user.click(remove);
const dialog = await screen.findByRole('dialog');
const confirm = within(dialog).getByRole('button', {
name: /^Confirmer/
});
await user.click(confirm);
const rowsAfter = screen.getAllByRole('row').slice(1);
expect(rowsAfter).toHaveLength(rowsBefore.length - 1);
});

it('should save the draft if at least one field is filled', async () => {
renderComponent();

Expand Down Expand Up @@ -224,7 +243,7 @@ describe('Campaign view', () => {
const tab = await screen.findByRole('tab', { name: /^Destinataires/ });
await user.click(tab);
const [edit] = await screen.findAllByRole('button', {
name: /^Éditer/
name: /^Éditer l’adresse/
});
await user.click(edit);
const [aside] = await screen.findAllByRole('complementary');
Expand Down Expand Up @@ -264,25 +283,6 @@ describe('Campaign view', () => {
expect(title).toBeVisible();
});

it('should confirm a recipient removal', async () => {
renderComponent();

const tab = await screen.findByRole('tab', { name: /^Destinataires/ });
await user.click(tab);
const rowsBefore = screen.getAllByRole('row').slice(1); // Remove headers
expect(rowsBefore).toHaveLength(housings.length);
const row = rowsBefore[rowsBefore.length - 1];
const remove = within(row).getByTitle(/^Supprimer le propriétaire/);
await user.click(remove);
const dialog = await screen.findByRole('dialog');
const confirm = within(dialog).getByRole('button', {
name: /^Confirmer/
});
await user.click(confirm);
const rowsAfter = screen.getAllByRole('row').slice(1);
expect(rowsAfter).toHaveLength(rowsBefore.length - 1);
});

// Hard to mock window.confirm because it's a browser-level function
it.todo(
'should warn the user before leaving the page if they have unsaved changes'
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8522,7 +8522,7 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:*, @types/react@npm:^18.3.10":
"@types/react@npm:*, @types/react@npm:^18.3.11":
version: 18.3.11
resolution: "@types/react@npm:18.3.11"
dependencies:
Expand Down Expand Up @@ -9387,7 +9387,7 @@ __metadata:
"@types/node": "npm:^20.16.10"
"@types/prop-types": "npm:^15.7.13"
"@types/randomstring": "npm:^1.3.0"
"@types/react": "npm:^18.3.10"
"@types/react": "npm:^18.3.11"
"@types/react-dom": "npm:^18.3.0"
"@types/react-router-dom": "npm:^5.3.3"
"@types/uuid": "npm:^9.0.8"
Expand Down

0 comments on commit 61e9458

Please sign in to comment.