Nick: prod and local-no-auth tests
This commit is contained in:
parent
749bd5f44d
commit
52620bab16
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -54,5 +54,5 @@ jobs:
|
|||||||
id: start_workers
|
id: start_workers
|
||||||
- name: Run E2E tests
|
- name: Run E2E tests
|
||||||
run: |
|
run: |
|
||||||
npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false
|
npm run test:prod
|
||||||
working-directory: ./apps/api
|
working-directory: ./apps/api
|
@ -11,6 +11,8 @@
|
|||||||
"start:dev": "nodemon --exec ts-node src/index.ts",
|
"start:dev": "nodemon --exec ts-node src/index.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "jest --verbose",
|
"test": "jest --verbose",
|
||||||
|
"test:local-no-auth":"npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false --testPathIgnorePatterns='src/__tests__/e2e_withAuth/*'",
|
||||||
|
"test:prod":"npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false --testPathIgnorePatterns='src/__tests__/e2e_noAuth/*'",
|
||||||
"workers": "nodemon --exec ts-node src/services/queue-worker.ts",
|
"workers": "nodemon --exec ts-node src/services/queue-worker.ts",
|
||||||
"worker:production": "node dist/src/services/queue-worker.js",
|
"worker:production": "node dist/src/services/queue-worker.js",
|
||||||
"mongo-docker": "docker run -d -p 2717:27017 -v ./mongo-data:/data/db --name mongodb mongo:latest",
|
"mongo-docker": "docker run -d -p 2717:27017 -v ./mongo-data:/data/db --name mongodb mongo:latest",
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
import { AuthResponse } from "../../src/types";
|
import { AuthResponse } from "../../src/types";
|
||||||
|
|
||||||
|
let warningCount = 0;
|
||||||
|
|
||||||
export function withAuth<T extends AuthResponse, U extends any[]>(
|
export function withAuth<T extends AuthResponse, U extends any[]>(
|
||||||
originalFunction: (...args: U) => Promise<T>
|
originalFunction: (...args: U) => Promise<T>
|
||||||
) {
|
) {
|
||||||
return async function (...args: U): Promise<T> {
|
return async function (...args: U): Promise<T> {
|
||||||
if (process.env.USE_DB_AUTHENTICATION === "false") {
|
if (process.env.USE_DB_AUTHENTICATION === "false") {
|
||||||
|
if (warningCount < 5) {
|
||||||
console.warn("WARNING - You're bypassing authentication");
|
console.warn("WARNING - You're bypassing authentication");
|
||||||
|
warningCount++;
|
||||||
|
}
|
||||||
return { success: true } as T;
|
return { success: true } as T;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user