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 <charles@twenty.com>
This commit is contained in:
17
server/scripts/run-integration.sh
Executable file
17
server/scripts/run-integration.sh
Executable file
@ -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
|
||||
18
server/scripts/setenv.sh
Executable file
18
server/scripts/setenv.sh
Executable file
@ -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
|
||||
Reference in New Issue
Block a user