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

Go to the future #2389

Merged
merged 37 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9e2b3ed
Update node to v18 + upgrade packages
wiinxt Nov 30, 2022
654b5aa
Update scripts
wiinxt Nov 15, 2022
3abdf15
Add comment about react-router-dom
wiinxt Nov 23, 2022
3a8e006
Update vite config
wiinxt Nov 15, 2022
d711d64
Update packages
wiinxt Nov 23, 2022
84d8a55
Update React render
wiinxt Nov 23, 2022
ccc5847
Fix env config in server
wiinxt Nov 23, 2022
f3a0f8c
Fix i18n type error
wiinxt Nov 23, 2022
ad88c16
Fix React type errors
wiinxt Nov 23, 2022
27dd1ae
Fix build
wiinxt Nov 22, 2022
d59bddb
Update packages
wiinxt Nov 22, 2022
0abb474
Add eslint warning on props spreading
wiinxt Nov 22, 2022
91c1606
Refacto mode functions to global var
wiinxt Nov 22, 2022
9da2b28
Fix storybook build
wiinxt Nov 22, 2022
d8d9481
Remove old types
wiinxt Nov 23, 2022
961540f
Upgrade packages
wiinxt Nov 23, 2022
5066d2c
Fix isDevelopment not found
wiinxt Nov 23, 2022
242c2bd
Remove unecessary async function
wiinxt Nov 24, 2022
c77cbe5
Disable react strict mode for react-spectrum
wiinxt Nov 24, 2022
1153a4f
Fix react 18 asynchrone bug on activité mixte
wiinxt Nov 24, 2022
1117365
Fix cypress error
wiinxt Nov 24, 2022
ad5c4ca
Fix script error
wiinxt Nov 24, 2022
a7ffbbf
Fix optional env var
wiinxt Nov 28, 2022
7ba95d2
Revert change in api
wiinxt Nov 29, 2022
892987a
Update cypress to v12 prerelease
wiinxt Nov 30, 2022
64b04c6
Fix ::set-output deprecation
wiinxt Nov 29, 2022
6742906
Fix result show on first render
wiinxt Nov 30, 2022
069539e
Add info about the error in crash page
wiinxt Nov 30, 2022
31f2241
Optimize search params simulation with reselect
wiinxt Nov 30, 2022
10377dc
Update Publicodes packages to beta 62
wiinxt Dec 1, 2022
ec2dff4
Update react-router-dom + minor updates
wiinxt Dec 1, 2022
14e1a1e
Add $ to styled-components props to avoid passing it to html element
wiinxt Dec 1, 2022
326925c
Catch divide by zero error
wiinxt Dec 1, 2022
aa1ada2
Fix regression test with division by zero
wiinxt Dec 5, 2022
306a3ad
Add cypress options
wiinxt Dec 5, 2022
84e4fb5
Refacto api test snapshot missingVariables
wiinxt Dec 5, 2022
f122348
test
wiinxt Dec 5, 2022
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
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ module.exports = {

'react/no-unknown-property': ['error', { ignore: ['css'] }],

/**
* Warning on props spreading cause typescript doesn't check type on it:
* https://github.com/microsoft/TypeScript/issues/18801#issuecomment-332610604
* Explicit spread is allow, example: <img {...{ prop1, prop2, prop3 }} />
*/
'react/jsx-props-no-spreading': ['warn', { explicitSpread: 'ignore' }],

// Auto fixable lint error
'prefer-const': 'error',
'padding-line-between-statements': [
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/install/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
steps:
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
cache: 'yarn'
- run: yarn install --immutable
shell: bash
12 changes: 7 additions & 5 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
en_url: ${{ steps.base-urls.outputs.en }}
steps:
- id: deploy-env
run: echo "::set-output name=name::${{ github.event.number || '${GITHUB_REF#refs/*/}' }}"
run: echo "name=${{ github.event.number || '${GITHUB_REF#refs/*/}' }}" >> $GITHUB_OUTPUT
- id: base-urls
run:
echo "::set-output name=server::${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise-server.osc-fr1.scalingo.io' || format('https://mon-entreprise-server-pr{0}.osc-fr1.scalingo.io', steps.deploy-env.outputs.name) }}";
echo "::set-output name=api::${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise-api.osc-fr1.scalingo.io' || format('https://mon-entreprise-api-pr{0}.osc-fr1.scalingo.io', steps.deploy-env.outputs.name) }}";
echo "::set-output name=fr::${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise.urssaf.fr' || format('https://{0}--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}";
echo "::set-output name=en::${{ steps.deploy-env.outputs.name == 'master' && 'https://mycompanyinfrance.urssaf.fr' || format('https://{0}-en--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}";
echo "server=${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise-server.osc-fr1.scalingo.io' || format('https://mon-entreprise-server-pr{0}.osc-fr1.scalingo.io', steps.deploy-env.outputs.name) }}" >> $GITHUB_OUTPUT;
echo "api=${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise-api.osc-fr1.scalingo.io' || format('https://mon-entreprise-api-pr{0}.osc-fr1.scalingo.io', steps.deploy-env.outputs.name) }}" >> $GITHUB_OUTPUT;
echo "fr=${{ steps.deploy-env.outputs.name == 'master' && 'https://mon-entreprise.urssaf.fr' || format('https://{0}--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}" >> $GITHUB_OUTPUT;
echo "en=${{ steps.deploy-env.outputs.name == 'master' && 'https://mycompanyinfrance.urssaf.fr' || format('https://{0}-en--mon-entreprise.netlify.app', steps.deploy-env.outputs.name) }}" >> $GITHUB_OUTPUT;

build:
needs: deploy-context
Expand Down Expand Up @@ -280,6 +280,8 @@ jobs:
- name: Test e2e mon-entreprise on preview (site=${{ matrix.site }}, browser=${{ matrix.browser}}, viewport=${{ matrix.viewport }})
uses: cypress-io/github-action@v4
with:
# Hack to use local node version, issue : https://github.com/cypress-io/github-action/issues/489#issuecomment-1021379037
command-prefix: '--'
install: false
working-directory: site
record: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
env-name: ${{ steps.deploy-env.outputs.name }}
steps:
- id: deploy-env
run: echo "::set-output name=name::${{ github.event.number || '${GITHUB_REF#refs/*/}' }}"
run: echo "name=${{ github.event.number || '${GITHUB_REF#refs/*/}' }}" >> $GITHUB_OUTPUT

algolia-rm-temp-index:
needs: deploy-context
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

783 changes: 0 additions & 783 deletions .yarn/releases/yarn-3.2.3.cjs

This file was deleted.

807 changes: 807 additions & 0 deletions .yarn/releases/yarn-3.3.0.cjs

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ plugins:
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
yarnPath: .yarn/releases/yarn-3.3.0.cjs
35 changes: 18 additions & 17 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "MIT",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"test": "vitest",
Expand All @@ -28,34 +29,34 @@
},
"dependencies": {
"@apidevtools/swagger-cli": "^4.0.4",
"@koa/cors": "^3.3.0",
"@koa/router": "^10.1.1",
"@publicodes/api": "^1.0.0-beta.61",
"@sentry/node": "^7.1.1",
"@sentry/tracing": "^7.1.1",
"got": "^12.5.1",
"ioredis": "^5.2.3",
"@koa/cors": "^4.0.0",
"@koa/router": "^12.0.0",
"@publicodes/api": "^1.0.0-beta.62",
"@sentry/node": "^7.22.0",
"@sentry/tracing": "^7.22.0",
"got": "^12.5.3",
"ioredis": "^5.2.4",
"koa": "^2.13.4",
"koa-body": "^5.0.0",
"koa-body": "^6.0.1",
"koa-static": "^5.0.0",
"modele-social": "workspace:^",
"nodemon": "^2.0.16",
"publicodes": "^1.0.0-beta.61",
"rate-limiter-flexible": "^2.3.8",
"swagger-ui-dist": "^4.11.1"
"nodemon": "^2.0.20",
"publicodes": "^1.0.0-beta.62",
"rate-limiter-flexible": "^2.4.1",
"swagger-ui-dist": "^4.15.5"
},
"devDependencies": {
"@types/koa": "^2.13.4",
"@types/koa": "^2.13.5",
"@types/koa-static": "^4.0.2",
"@types/koa__cors": "^3.3.0",
"@types/koa__router": "^8.0.11",
"@types/node": "^17.0.35",
"@types/koa__router": "^12.0.0",
"@types/node": "^18.11.10",
"@types/swagger-ui-dist": "^3.30.1",
"chai-http": "^4.3.0",
"rimraf": "^3.0.2",
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"vitest": "^0.24.0",
"typescript": "^4.9.3",
"vitest": "^0.25.3",
"wait-on": "^6.0.1"
}
}
138 changes: 69 additions & 69 deletions api/source/test-e2e/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ exports[`e2e test mon-entreprise api > Test evaluate brut => net + super brut 2`
{
"evaluate": [
{
"missingVariables": {
"dirigeant . gérant minoritaire": 11856115,
"entreprise . catégorie juridique": 90042641,
"salarié . activité partielle": 149408,
"salarié . contrat": 1112382,
"salarié . contrat . statut cadre": 3596,
"salarié . contrat . temps de travail . temps partiel": 231246,
"salarié . convention collective": 249806,
"salarié . cotisations . prévoyances . santé . montant": 2320,
"salarié . cotisations . prévoyances . santé . taux employeur": 2320,
"salarié . régimes spécifiques . DFS": 1624,
"salarié . régimes spécifiques . alsace moselle": 352,
"salarié . rémunération . avantages en nature": 23027,
"salarié . rémunération . frais professionnels . titres-restaurant": 25347,
"salarié . rémunération . frais professionnels . trajets domicile travail . forfait mobilités durables . montant": 78010,
"salarié . rémunération . frais professionnels . trajets domicile travail . prime de transport . montant": 152250,
"salarié . rémunération . frais professionnels . trajets domicile travail . transports publics . montant": 121394,
"salarié . rémunération . primes . activité . base": 23026,
"salarié . rémunération . primes . fin d'année": 23026,
"salarié . temps de travail . heures supplémentaires": 46922,
"situation personnelle . domiciliation fiscale à l'étranger": 580,
"établissement . commune . département": 130952,
"établissement . commune . département . outre-mer": 74244,
},
"missingVariables": [
"dirigeant . gérant minoritaire",
"entreprise . catégorie juridique",
"salarié . activité partielle",
"salarié . contrat",
"salarié . contrat . statut cadre",
"salarié . contrat . temps de travail . temps partiel",
"salarié . convention collective",
"salarié . cotisations . prévoyances . santé . montant",
"salarié . cotisations . prévoyances . santé . taux employeur",
"salarié . régimes spécifiques . DFS",
"salarié . régimes spécifiques . alsace moselle",
"salarié . rémunération . avantages en nature",
"salarié . rémunération . frais professionnels . titres-restaurant",
"salarié . rémunération . frais professionnels . trajets domicile travail . forfait mobilités durables . montant",
"salarié . rémunération . frais professionnels . trajets domicile travail . prime de transport . montant",
"salarié . rémunération . frais professionnels . trajets domicile travail . transports publics . montant",
"salarié . rémunération . primes . activité . base",
"salarié . rémunération . primes . fin d'année",
"salarié . temps de travail . heures supplémentaires",
"situation personnelle . domiciliation fiscale à l'étranger",
"établissement . commune . département",
"établissement . commune . département . outre-mer",
],
"nodeValue": 2749.50805,
"traversedVariables": [
"salarié . rémunération . net . à payer avant impôt",
Expand Down Expand Up @@ -263,38 +263,38 @@ exports[`e2e test mon-entreprise api > Test evaluate brut => net + super brut 2`
},
},
{
"missingVariables": {
"dirigeant . gérant minoritaire": 2076668,
"entreprise . TVA": 5,
"entreprise . association non lucrative": 11,
"entreprise . catégorie juridique": 15765586,
"entreprise . salariés . effectif . seuil": 515,
"salarié . activité partielle": 24153,
"salarié . contrat": 193409,
"salarié . contrat . statut cadre": 811,
"salarié . contrat . temps de travail . temps partiel": 40733,
"salarié . convention collective": 47961,
"salarié . cotisations . ATMP . taux fonctions support": 11,
"salarié . cotisations . exonérations . JEI": 539,
"salarié . cotisations . exonérations . lodeom . zone un": 111,
"salarié . cotisations . prévoyances . santé . montant": 591,
"salarié . cotisations . prévoyances . santé . taux employeur": 591,
"salarié . coût total employeur . aides . emploi franc . éligible": 45,
"salarié . régimes spécifiques . DFS": 1059,
"salarié . régimes spécifiques . alsace moselle": 27,
"salarié . rémunération . avantages en nature": 4953,
"salarié . rémunération . frais professionnels . titres-restaurant": 5369,
"salarié . rémunération . frais professionnels . trajets domicile travail . forfait mobilités durables . montant": 15601,
"salarié . rémunération . frais professionnels . trajets domicile travail . prime de transport . montant": 28913,
"salarié . rémunération . frais professionnels . trajets domicile travail . transports publics . montant": 24169,
"salarié . rémunération . primes . activité . base": 4953,
"salarié . rémunération . primes . fin d'année": 4953,
"salarié . temps de travail . heures supplémentaires": 7605,
"établissement . commune . département": 24451,
"établissement . commune . département . outre-mer": 13819,
"établissement . taux ATMP": 11,
"établissement . taux ATMP . taux collectif": 7,
},
"missingVariables": [
"dirigeant . gérant minoritaire",
"entreprise . TVA",
"entreprise . association non lucrative",
"entreprise . catégorie juridique",
"entreprise . salariés . effectif . seuil",
"salarié . activité partielle",
"salarié . contrat",
"salarié . contrat . statut cadre",
"salarié . contrat . temps de travail . temps partiel",
"salarié . convention collective",
"salarié . cotisations . ATMP . taux fonctions support",
"salarié . cotisations . exonérations . JEI",
"salarié . cotisations . exonérations . lodeom . zone un",
"salarié . cotisations . prévoyances . santé . montant",
"salarié . cotisations . prévoyances . santé . taux employeur",
"salarié . coût total employeur . aides . emploi franc . éligible",
"salarié . régimes spécifiques . DFS",
"salarié . régimes spécifiques . alsace moselle",
"salarié . rémunération . avantages en nature",
"salarié . rémunération . frais professionnels . titres-restaurant",
"salarié . rémunération . frais professionnels . trajets domicile travail . forfait mobilités durables . montant",
"salarié . rémunération . frais professionnels . trajets domicile travail . prime de transport . montant",
"salarié . rémunération . frais professionnels . trajets domicile travail . transports publics . montant",
"salarié . rémunération . primes . activité . base",
"salarié . rémunération . primes . fin d'année",
"salarié . temps de travail . heures supplémentaires",
"établissement . commune . département",
"établissement . commune . département . outre-mer",
"établissement . taux ATMP",
"établissement . taux ATMP . taux collectif",
],
"nodeValue": 4751.7952000000005,
"traversedVariables": [
"salarié . coût total employeur",
Expand Down Expand Up @@ -539,9 +539,9 @@ exports[`e2e test mon-entreprise api > Test evaluate micro entreprise 2`] = `
{
"evaluate": [
{
"missingVariables": {
"entreprise . activité . mixte": 66,
},
"missingVariables": [
"entreprise . activité . mixte",
],
"nodeValue": 9324,
"traversedVariables": [
"dirigeant . auto-entrepreneur . cotisations et contributions",
Expand Down Expand Up @@ -604,11 +604,11 @@ exports[`e2e test mon-entreprise api > Test evaluate micro entreprise 2`] = `
},
},
{
"missingVariables": {
"entreprise . activité . mixte": 410,
"établissement . commune . département": 18,
"établissement . commune . département . outre-mer": 7,
},
"missingVariables": [
"entreprise . activité . mixte",
"établissement . commune . département",
"établissement . commune . département . outre-mer",
],
"nodeValue": 1469.1600000000062,
"traversedVariables": [
"dirigeant . rémunération . impôt",
Expand Down Expand Up @@ -662,11 +662,11 @@ exports[`e2e test mon-entreprise api > Test evaluate micro entreprise 2`] = `
},
},
{
"missingVariables": {
"entreprise . activité . mixte": 476,
"établissement . commune . département": 18,
"établissement . commune . département . outre-mer": 7,
},
"missingVariables": [
"entreprise . activité . mixte",
"établissement . commune . département",
"établissement . commune . département . outre-mer",
],
"nodeValue": 31207,
"traversedVariables": [
"dirigeant . auto-entrepreneur . revenu net . après impôt",
Expand Down
28 changes: 25 additions & 3 deletions api/source/test-e2e/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ import { server } from '../index.js'

chai.use(chaiHttp)

const transformResult = (obj: Record<string, unknown>) => {
if (obj && Array.isArray(obj.evaluate) && obj.evaluate.length > 0) {
return {
...obj,
evaluate: obj.evaluate.map(
(elem: { missingVariables: Record<string, unknown> }) => ({
...elem,
missingVariables: Object.keys(elem.missingVariables).sort(),
})
),
}
}

return obj
}

describe('e2e test mon-entreprise api', () => {
it('Test evaluate brut => net + super brut', async () => {
await expect(
Expand All @@ -24,7 +40,9 @@ describe('e2e test mon-entreprise api', () => {
.then((res) => {
expect(res.status).toMatchInlineSnapshot('200')

return JSON.parse(res.text) as Record<string, unknown>
return transformResult(
JSON.parse(res.text) as Record<string, unknown>
)
})
).resolves.toMatchSnapshot()
})
Expand Down Expand Up @@ -59,7 +77,9 @@ describe('e2e test mon-entreprise api', () => {
.then((res) => {
expect(res.status).toMatchInlineSnapshot('200')

return JSON.parse(res.text) as Record<string, unknown>
return transformResult(
JSON.parse(res.text) as Record<string, unknown>
)
})
).resolves.toMatchSnapshot()
})
Expand All @@ -72,7 +92,9 @@ describe('e2e test mon-entreprise api', () => {
.then((res) => {
expect(res.status).toMatchInlineSnapshot('200')

return JSON.parse(res.text) as Record<string, unknown>
return transformResult(
JSON.parse(res.text) as Record<string, unknown>
)
})
).resolves.toMatchSnapshot()
})
Expand Down
7 changes: 5 additions & 2 deletions api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
"resolveJsonModule": true,

/* Advanced Options */
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,

// remove this when vite support "NodeNext" : https://github.com/vitejs/vite/issues/10481 or https://github.com/vitejs/vite/issues/8993
"skipLibCheck": true
},
"ts-node": {
"esm": true
},
"include": ["source"],
"exclude": ["**/node_modules", "**/dist", "vitest.config.ts"]
"exclude": ["**/dist", "vitest.config.ts"]
}
2 changes: 1 addition & 1 deletion exoneration-covid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"devDependencies": {
"js-yaml": "^4.1.0",
"onchange": "^7.1.0",
"publicodes": "=1.0.0-beta.55"
"publicodes": "^1.0.0-beta.62"
},
"peerDependencies": {
"publicodes": "^1.0.0-beta.55"
Expand Down
2 changes: 1 addition & 1 deletion modele-social/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"devDependencies": {
"js-yaml": "^4.1.0",
"onchange": "^7.1.0",
"publicodes": "^1.0.0-beta.55"
"publicodes": "^1.0.0-beta.62"
},
"peerDependencies": {
"publicodes": "^1.0.0-beta.55"
Expand Down
Loading