add tests infrastructure

This commit is contained in:
Emily
2024-08-29 16:31:44 +02:00
parent 9b9ed3e9ad
commit 79309cc537
5 changed files with 2469 additions and 4 deletions

3
broker/.gitignore vendored
View File

@@ -4,4 +4,5 @@ ecosystem.config.cjs
dist
scripts/start_dev.js
package-lock.json
build_all.bat
build_all.bat
tests

13
broker/jest.config.js Normal file
View File

@@ -0,0 +1,13 @@
/** @type {import('ts-jest').JestConfigWithTsJest} **/
module.exports = {
testEnvironment: "node",
transform: {
"^.+.tsx?$": ["ts-jest",{}],
},
moduleNameMapper: {
'@services/(.*)': '<rootDir>/../shared/services/$1',
'@data/(.*)': '<rootDir>/../shared/data/$1',
'@functions/(.*)': '<rootDir>/../shared/functions/$1',
'@schema/(.*)': '<rootDir>/../shared/schema/$1',
}
};

View File

@@ -8,13 +8,17 @@
"ua-parser-js": "^1.0.37"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.13",
"@types/nodemailer": "^6.4.15",
"@types/ua-parser-js": "^0.7.39",
"glob": "^10.4.1",
"jest": "^29.7.0",
"node-ssh": "^13.2.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
},
@@ -28,10 +32,11 @@
"create_db": "cd scripts && ts-node create_database.ts",
"build_all": "npm run compile && npm run build && npm run create_db",
"docker-build": "docker build -t litlyx-broker -f Dockerfile ../",
"docker-inspect": "docker run -it litlyx-broker sh"
"docker-inspect": "docker run -it litlyx-broker sh",
"test": "jest"
},
"keywords": [],
"author": "Emily",
"license": "MIT",
"description": "Queue broker for Litlyx - Saves events to database."
}
}

2439
broker/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,14 @@
{
"compilerOptions": {
"baseUrl": ".",
"module": "NodeNext",
"target": "ESNext",
"esModuleInterop": true,
"outDir": "dist",
"types": [
"node",
"jest"
],
"paths": {
"@schema/*": [
"../shared/schema/*"
@@ -21,7 +26,9 @@
},
"include": [
"src/**/*.ts",
"scripts/**/*.ts"
"scripts/**/*.ts",
"tests/**/*.test.ts",
"tests/utils.ts",
],
"exclude": [
"node_modules"