Skip to content

Commit b41fa36

Browse files
committed
Update test file
1 parent ea8454e commit b41fa36

File tree

5 files changed

+37
-17
lines changed

5 files changed

+37
-17
lines changed

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

Whitespace-only changes.

course-matrix/backend/jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const config: Config = {
66
// to obtain access to the matchers.
77
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
88
modulePaths: ["<rootDir>"],
9-
testEnvironment: "jsdom",
9+
testEnvironment: "node",
1010
transform: {
1111
"^.+\\.(ts|tsx)$": [
1212
"ts-jest",

course-matrix/backend/package-lock.json

Lines changed: 28 additions & 14 deletions
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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "backend",
33
"version": "1.0.0",
4+
"type": "module",
45
"description": "",
56
"main": "src/index.ts",
67
"scripts": {
@@ -38,15 +39,16 @@
3839
"@testing-library/react": "^16.0.0",
3940
"@types/cookie-parser": "^1.4.8",
4041
"@types/cors": "^2.8.17",
41-
"@types/jest": "^29.5.12",
42+
"@types/jest": "^29.5.14",
43+
"@types/mocha": "^10.0.10",
4244
"@types/supertest": "^6.0.2",
4345
"@types/swagger-jsdoc": "^6.0.4",
4446
"@types/swagger-ui-express": "^4.1.7",
4547
"identity-obj-proxy": "^3.0.0",
4648
"jest": "^29.7.0",
4749
"jest-environment-jsdom": "^29.7.0",
4850
"supertest": "^7.0.0",
49-
"ts-jest": "^29.2.3",
51+
"ts-jest": "^29.2.6",
5052
"ts-node": "^10.9.2"
5153
}
5254
}

course-matrix/backend/src/controllers/timetablesController.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default {
1414

1515
createTimetable: asyncHandler(async (req: Request, res: Response) => {
1616
try {
17+
console.log("Incoming Request Body:", req.body);
1718
//Get user id from session authentication to insert in the user_id col
1819
const user_id = (req as any).user.id;
1920

@@ -45,6 +46,7 @@ export default {
4546
.json({ error: "A timetable with this title already exists" });
4647
}
4748

49+
console.log("Calling Supabase insert...");
4850
//Create query to insert the user_id and timetable_title into the db
4951
let insertTimetable = supabase
5052
.schema("timetable")
@@ -67,8 +69,10 @@ export default {
6769
return res.status(400).json({ error: timetableError.message });
6870
}
6971

72+
console.log("Insert Successful:");
7073
return res.status(201).json(timetableData);
7174
} catch (error) {
75+
console.error("Error creating timetable:", error);
7276
return res.status(500).send({ error });
7377
}
7478
}),

0 commit comments

Comments
 (0)