Skip to content

Commit 0d3b29e

Browse files
committed
Update test to handle merged AI code from develop
1 parent 36f654b commit 0d3b29e

File tree

6 files changed

+57
-4
lines changed

6 files changed

+57
-4
lines changed

course-matrix/backend/__tests__/restrictionsController.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ jest.mock("@pinecone-database/pinecone", () => ({
4242
})),
4343
}));
4444

45+
jest.mock("node-cron", () => ({
46+
schedule: jest.fn(), // Mock the `schedule` function
47+
}));
48+
49+
4550
afterAll(async () => {
4651
server.close();
4752
});

course-matrix/backend/__tests__/timetablesController.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ jest.mock("@pinecone-database/pinecone", () => ({
3838
})),
3939
}));
4040

41+
jest.mock("node-cron", () => ({
42+
schedule: jest.fn(), // Mock the `schedule` function
43+
}));
44+
4145
afterAll(async () => {
4246
server.close();
4347
});
@@ -329,7 +333,7 @@ describe("PUT /api/timetables/:id", () => {
329333
expect(response.statusCode).toBe(400);
330334
expect(response.body).toEqual({
331335
error:
332-
"New timetable title or semester or updated favorite status is required when updating a timetable",
336+
"New timetable title or semester or updated favorite status or email notifications enabled is required when updating a timetable",
333337
});
334338
});
335339

course-matrix/backend/jest.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Config } from "jest";
22

33
const config: Config = {
44
preset: "ts-jest",
5-
moduleNameMapper: { "\\.(css|scss)$": "identity-obj-proxy" },
5+
moduleNameMapper: { "\\.(css|scss)$": "identity-obj-proxy", "^(\\.{1,2}/.*)\\.js$": "$1" },
66
// to obtain access to the matchers.
77
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
88
modulePaths: ["<rootDir>"],
@@ -16,6 +16,9 @@ const config: Config = {
1616
],
1717
"^.+\\.(js|jsx)$": "babel-jest",
1818
},
19+
transformIgnorePatterns: [
20+
"/node_modules/(?!(node-cron|uuid)/)" // Keep transforming `node-cron`
21+
],
1922
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
2023
};
2124

course-matrix/backend/package-lock.json

Lines changed: 36 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

course-matrix/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@testing-library/react": "^16.0.0",
4545
"@types/cookie-parser": "^1.4.8",
4646
"@types/cors": "^2.8.17",
47-
"@types/jest": "^29.5.12",
47+
"@types/jest": "^29.5.14",
4848
"@types/node-cron": "^3.0.11",
4949
"@types/supertest": "^6.0.2",
5050
"@types/swagger-jsdoc": "^6.0.4",

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)