Skip to content

Commit

Permalink
test: finish integration tests for authentication
Browse files Browse the repository at this point in the history
fix: tests in the ci
  • Loading branch information
tericcabrel committed Jun 3, 2024
1 parent 67856a7 commit 52f3a9f
Show file tree
Hide file tree
Showing 34 changed files with 683 additions and 192 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Run tests
run: |
yarn prisma migrate dev --schema=packages/domain/prisma/schema.prisma
yarn test --runInBand --coverage
yarn test -- --runInBand --coverage
preview-frontend:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions apps/backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ SESSION_LIFETIME=90# 90 days
SENTRY_DSN=
SENTRY_ENABLED=false
SNIPPET_RENDERER_API_URL=http:https://localhost:3000/dev
JWT_SECRET=jwtSecret
1 change: 1 addition & 0 deletions apps/backend/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ SESSION_LIFETIME=90
SENTRY_DSN=sentry-dsn
SENTRY_ENABLED=false
SNIPPET_RENDERER_API_URL=http:https://localhost:3000/dev
JWT_SECRET=jwtSecret
3 changes: 2 additions & 1 deletion apps/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ These packages are located in the folder `packages`, so you might need to change
Here are the packages used in this project:

* [@snipcode/domain](../../packages/domain)
* [@snipcode/logger](../../packages/logger-old)
* [@snipcode/embed](../../packages/embed)
* [@snipcode/utils](../../packages/utils)

## Set up the project
Expand Down Expand Up @@ -67,6 +67,7 @@ nano .env.local
| SENTRY_DSN | Sentry DSN |
| SENTRY_ENABLED | Enable/Disable Sentry |
| SNIPPET_RENDERER_API_URL | Base URL of the API (the current one) for generating the html content from a snippet |
| JWT_SECRET | The secret code for decoding JWT token generated in the application |

Start the application
```bash
Expand Down
1 change: 1 addition & 0 deletions apps/backend/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type EnvironmentVariables = {
GITHUB_CLIENT_SECRET: string;
HOST: string;
INTROSPECTION_ENABLED: string;
JWT_SECRET: string;
NODE_ENV: string;
PORT: string;
REQUEST_TIMEOUT: string;
Expand Down
3 changes: 2 additions & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"gql:gen:types": "ts-node scripts/generate-graphql-types.ts",
"lint": "eslint \"{src,scripts}/**/*.ts\" --fix",
"prod": "node dist/main",
"test": "yarn workspace @snipcode/domain db:test && dotenv -e .env.test -- jest --watchAll --runInBand",
"test": "yarn workspace @snipcode/domain db:test && dotenv -e .env.test -- jest --runInBand",
"test:watch": "yarn workspace @snipcode/domain db:test && dotenv -e .env.test -- jest --watchAll --runInBand",
"test:coverage": "yarn test --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:it": "yarn test integration.spec.ts"
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/configs/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const EnvironmentVariablesSchema = z.object({
GITHUB_CLIENT_SECRET: z.string(),
HOST: z.string(),
INTROSPECTION_ENABLED: z.boolean({ coerce: true }),
JWT_SECRET: z.string(),
NODE_ENV: z.union([z.literal('development'), z.literal('production'), z.literal('test')]),
PORT: z.number({ coerce: true }).min(7000).max(8000),
SENTRY_DSN: z.string(),
Expand Down
Loading

0 comments on commit 52f3a9f

Please sign in to comment.