Skip to content

Commit

Permalink
fix/confidentiality issue (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
jokesterfr authored Sep 13, 2024
1 parent b779e8c commit 35eb61f
Show file tree
Hide file tree
Showing 40 changed files with 1,733 additions and 753 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/quality-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,38 @@ jobs:
docker compose logs cloudsync-mock prestashop
docker compose down -v
working-directory: e2e-env

e2e-lint:
name: Lint E2E tests
runs-on: ubuntu-latest
timeout-minutes: 30
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- uses: pnpm/action-setup@v3
with:
version: latest

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_BUILDER_VERSION }}
cache: "pnpm"
cache-dependency-path: e2e/pnpm-lock.yaml

- name: Cache vendor folder
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

- name: Install dependencies
run: pnpm install --no-optional --force
working-directory: e2e

- name: Lint test files
run: pnpm lint && pnpm format
working-directory: e2e
2 changes: 0 additions & 2 deletions controllers/front/apiHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ class ps_EventbusApiHealthCheckModuleFrontController extends AbstractApiControll
*/
public function init()
{
/*
try {
parent::init();
} catch (UnauthorizedException $exception) {
$this->isAuthentifiedCall = false;
}
*/
}

/**
Expand Down
16 changes: 16 additions & 0 deletions e2e-env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@ Or specifically only starting PrestaShop (and its dependencies) with special com
docker compose up prestashop --force-recreate --renew-anon-volumes
```

## Testing

Simple!

Is the module healthy?

```sh
curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiHealthCheck&job_id=valid-job-1" | jq .
```

Capture orders:

```sh
curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiOrders&job_id=valid-job-1" | jq .
```

## Make changes to the mock

If you need to make change to the mocks, they can be built and run locally using scripts in `package.json`.
Expand Down
9 changes: 9 additions & 0 deletions e2e/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @ts-check

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
);
32 changes: 21 additions & 11 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@
"scripts": {
"test:e2e": "jest --config=jest.config.json",
"test:e2e:watch": "jest --config=jest.config.json --watchAll",
"test:e2e:detectOpenHandles": "jest --config=jest.config.json --detectOpenHandles"
"test:e2e:detectOpenHandles": "jest --config=jest.config.json --detectOpenHandles",
"lint": "eslint 'src/**/*.ts'",
"lint:fix": "eslint 'src/**/*.ts' --fix",
"format": "prettier --check ./src",
"format:fix": "prettier --write ./src",
"fix": "pnpm format:fix && pnpm lint:fix"
},
"devDependencies": {
"@eslint/js": "^9.10.0",
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"@types/ramda": "^0.30.0",
"@types/eslint__js": "^8.42.3",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.4",
"@types/ramda": "^0.30.2",
"@types/semver": "^7.5.8",
"@types/ws": "^8.5.10",
"axios": "^1.7.4",
"@types/ws": "^8.5.12",
"axios": "^1.7.7",
"eslint": "^9.10.0",
"jest": "^29.7.0",
"jest-expect-message": "^1.1.3",
"jest-extended": "^4.0.2",
"jest-mock-extended": "^3.0.7",
"ramda": "^0.30.0",
"prettier": "^3.3.3",
"ramda": "^0.30.1",
"rxjs": "^7.8.1",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5",
"ws": "^8.17.1"
"ts-jest": "^29.2.5",
"typescript": "^5.6.2",
"typescript-eslint": "^8.5.0",
"ws": "^8.18.0"
},
"engines": {
"yarn": "please use pnpm",
Expand All @@ -32,6 +42,6 @@
"pnpm": ">=8"
},
"dependencies": {
"semver": "^7.6.2"
"semver": "^7.6.3"
}
}
Loading

0 comments on commit 35eb61f

Please sign in to comment.