feat: Introduce jest for backend tests

This commit is contained in:
Faruk AYDIN
2023-09-30 14:31:01 +02:00
parent 1a3418de58
commit 13263eea76
4 changed files with 3073 additions and 2305 deletions

View File

@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};

View File

@@ -10,7 +10,7 @@
"build:watch": "nodemon --watch 'src/**/*.ts' --watch 'bin/**/*.ts' --exec yarn build --ext ts",
"start": "node dist/src/server.js",
"pretest": "APP_ENV=test ts-node ./test/setup/prepare-test-env.ts",
"test": "APP_ENV=test ava",
"test": "APP_ENV=test jest",
"lint": "eslint . --ignore-path ../../.eslintignore",
"db:create": "ts-node ./bin/database/create.ts",
"db:seed:user": "ts-node ./bin/database/seed-user.ts",
@@ -121,6 +121,7 @@
"@types/crypto-js": "^4.0.2",
"@types/express": "^4.17.15",
"@types/http-errors": "^1.8.1",
"@types/jest": "^29.5.5",
"@types/jsonwebtoken": "^8.5.8",
"@types/lodash.get": "^4.4.6",
"@types/memory-cache": "^0.2.2",
@@ -132,8 +133,10 @@
"@types/pino": "^7.0.5",
"@types/pluralize": "^0.0.30",
"@types/showdown": "^2.0.1",
"jest": "^29.7.0",
"nodemon": "^2.0.13",
"sinon": "^11.1.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.2.1",
"ts-node-dev": "^1.1.8"
},

View File

@@ -0,0 +1,3 @@
test('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});

5365
yarn.lock

File diff suppressed because it is too large Load Diff