Skip to content

Commit

Permalink
update jest config and found this github issue be useful: kulshekhar/…
Browse files Browse the repository at this point in the history
  • Loading branch information
algebra2boy committed Jan 17, 2024
1 parent 49a6fda commit 05916f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions api/jest.config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"preset": "ts-jest",
"collectCoverageFrom": ["<rootDir>/src/app/**/*.ts"],
"testMatch": ["<rootDir>/src/tests/**/*.test.ts"],
"testPathIgnorePatterns": ["<rootDir>/dist/", "<rootDir>/node_modules/", "<rootDir>/logs/"],
"preset": "ts-jest/presets/default-esm",
"testEnvironment": "node",
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
"transform": {
"^.+\\.{ts}?$": [
"^.+\\.ts$": [
"ts-jest", {
"useESM": true
}
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start:docker": "pm2-runtime start src/app/server.ts --name backend -i 5",
"start": "ts-node src/app/server.ts",
"dev": "nodemon src/app/server.ts",
"test": "jest app/tests",
"test": "jest src/tests",
"format": "prettier --write src/ --config .prettierrc",
"lint": "eslint src/ --config .eslintrc.json"
},
Expand Down
6 changes: 3 additions & 3 deletions api/src/tests/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Feedback } from "../app/services/reviews/reviews.model.js";
import { computeAverageScore } from "../app/utils/computeScore.utils.js";
import { computeAverageScore } from "../../src/app/utils/computeScore.utils.js";

describe("test compute score utils function", () => {
it("test feedback with all one star rating", () => {
Expand All @@ -12,8 +12,8 @@ describe("test compute score utils function", () => {
seatAvailability: 1,
taste: 1
}
// const score: number = computeAverageScore(feedback);
const score: number = computeAverageScore(feedback);

// expect(score).toEqual(1);
expect(score).toEqual(1);
});
})

0 comments on commit 05916f2

Please sign in to comment.