-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement e2e test for CompanyResolver (#944)
* feat: wip e2e server test * feat: use github action postgres & use infra for local * feat: company e2e test * feat: add company e2e test for permissions * Simplify server e2e test run * Fix lint --------- Co-authored-by: Charles Bochet <[email protected]>
- Loading branch information
1 parent
9027406
commit 157e5b9
Showing
25 changed files
with
654 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
-- Create the default database for development | ||
CREATE DATABASE "default"; | ||
|
||
-- Create the tests database for e2e testing | ||
CREATE DATABASE "tests"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
DEBUG_MODE=true | ||
AUTH_GOOGLE_ENABLED=false | ||
ACCESS_TOKEN_SECRET=secret_jwt | ||
ACCESS_TOKEN_EXPIRES_IN=1d | ||
REFRESH_TOKEN_SECRET=secret_refresh_token | ||
REFRESH_TOKEN_EXPIRES_IN=30d | ||
LOGIN_TOKEN_SECRET=secret_login_token | ||
LOGIN_TOKEN_EXPIRES_IN=15m | ||
FRONT_AUTH_CALLBACK_URL=http://localhost:3001/auth/callback | ||
PG_DATABASE_URL=postgres://postgres:postgrespassword@localhost:5432/tests?connection_limit=1 | ||
STORAGE_TYPE=local | ||
STORAGE_LOCAL_PATH=.local-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
# src/run-integration.sh | ||
|
||
DIR="$(cd "$(dirname "$0")" && pwd)" | ||
source $DIR/setenv.sh | ||
|
||
npx ts-node ./test/utils/check-db.ts | ||
EXIT_CODE=$? | ||
|
||
if [ $EXIT_CODE -ne 0 ]; then | ||
echo '🟡 - Database is not initialized. Running migrations...' | ||
npx prisma migrate reset --force && yarn prisma:generate | ||
else | ||
echo "🟢 - Database is already initialized." | ||
fi | ||
|
||
yarn jest --config ./test/jest-e2e.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
# scripts/setenv.sh | ||
|
||
# Get script's directory | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
# Construct the absolute path of .env file in the project root directory | ||
ENV_PATH="${SCRIPT_DIR}/../.env.test" | ||
|
||
# Check if the file exists | ||
if [ -f "${ENV_PATH}" ]; then | ||
echo "🔵 - Loading environment variables from "${ENV_PATH}"..." | ||
# Export env vars | ||
export $(grep -v '^#' ${ENV_PATH} | xargs) | ||
else | ||
echo "Error: ${ENV_PATH} does not exist." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.