Skip to content

Commit 6a3acc6

Browse files
committed
2 parents 202c807 + 2699f2a commit 6a3acc6

File tree

8 files changed

+121
-2
lines changed

8 files changed

+121
-2
lines changed

course-matrix/backend/src/routes/courseRouter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import express from "express";
2-
32
import coursesController from "../controllers/coursesController";
43
import departmentsController from "../controllers/departmentsController";
54
import offeringsController from "../controllers/offeringsController";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export default "SvgrURL";
2+
export const ReactComponent = "div";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "@testing-library/jest-dom";
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"compilerOptions": {
3+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4+
"target": "ES2020",
5+
"useDefineForClassFields": true,
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"module": "ESNext",
8+
"skipLibCheck": true,
9+
10+
/* Bundler mode */
11+
"moduleResolution": "bundler",
12+
"allowImportingTsExtensions": true,
13+
"isolatedModules": true,
14+
"moduleDetection": "force",
15+
"noEmit": true,
16+
"jsx": "react-jsx",
17+
18+
/* Linting */
19+
"strict": true,
20+
"noUnusedLocals": true,
21+
"noUnusedParameters": true,
22+
"noFallthroughCasesInSwitch": true,
23+
"noUncheckedSideEffectImports": true,
24+
25+
"baseUrl": ".",
26+
"paths": {
27+
"@/*": ["./src/*"]
28+
}
29+
},
30+
"include": ["src", "tests/setupTests.ts"]
31+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import configureStore from "redux-mock-store";
2+
import { UserMenu } from "../src/components/UserMenu";
3+
import { afterEach, beforeEach, describe, expect, test } from "@jest/globals";
4+
5+
// const mockStore = configureStore([]);
6+
7+
describe("UserMenu Component", () => {
8+
beforeEach(() => {
9+
localStorage.setItem(
10+
"userInfo",
11+
JSON.stringify({
12+
user: {
13+
id: "123",
14+
user_metadata: {
15+
username: "John Doe",
16+
17+
},
18+
},
19+
}),
20+
);
21+
});
22+
23+
afterEach(() => {
24+
localStorage.clear();
25+
});
26+
27+
test("check local storage", () => {
28+
expect(localStorage.getItem("userInfo")).not.toBeNull();
29+
});
30+
31+
// Will finish the rest of the tests below in Sprint 3
32+
33+
// test("opens edit account dialog", () => {
34+
// render(
35+
// <Provider store={store}>
36+
// <Router>
37+
// <UserMenu />
38+
// </Router>
39+
// </Provider>,
40+
// );
41+
42+
// fireEvent.click(screen.getByText("John Doe"));
43+
// fireEvent.click(screen.getByText("Edit Account"));
44+
45+
// expect(screen.getByText("Edit Account")).toBeInTheDocument();
46+
// expect(screen.getByLabelText("New User Name")).toBeInTheDocument();
47+
// });
48+
49+
// test("opens delete account dialog", () => {
50+
// render(
51+
// <Provider store={store}>
52+
// <Router>
53+
// <UserMenu />
54+
// </Router>
55+
// </Provider>,
56+
// );
57+
58+
// fireEvent.click(screen.getByText("John Doe"));
59+
// fireEvent.click(screen.getByText("Delete Account"));
60+
61+
// expect(screen.getByText("Delete Account")).toBeInTheDocument();
62+
// expect(
63+
// screen.getByText(
64+
// "Are you sure you want to delete your account? This action cannot be undone.",
65+
// ),
66+
// ).toBeInTheDocument();
67+
// });
68+
69+
// test("logs out user", () => {
70+
// render(
71+
// <Provider store={store}>
72+
// <Router>
73+
// <UserMenu />
74+
// </Router>
75+
// </Provider>,
76+
// );
77+
78+
// fireEvent.click(screen.getByText("John Doe"));
79+
// fireEvent.click(screen.getByText("Logout"));
80+
81+
// // Add assertions to check if the user is logged out
82+
// });
83+
});

course-matrix/frontend/src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,4 @@ input:-webkit-autofill:focus {
153153
[class*="sx__"] {
154154
transition-duration: 0s !important;
155155
animation-duration: 0s !important;
156-
}
156+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export default "SvgrURL";
2+
export const ReactComponent = "div";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "@testing-library/jest-dom";

0 commit comments

Comments
 (0)