Skip to content

Commit 453f25f

Browse files
committed
Remove commented code
1 parent b5e834b commit 453f25f

File tree

14 files changed

+14
-123
lines changed

14 files changed

+14
-123
lines changed

backend/matching-service/src/handlers/matchHandler.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,6 @@ export const getMatchIdByUid = (uid: string): string | null => {
8080
return null;
8181
};
8282

83-
export const getMatchByUid = (
84-
uid: string
85-
): { matchId: string; partner: MatchUser } | null => {
86-
for (const [matchId, match] of matches) {
87-
if (match.matchUser1.id === uid) {
88-
return { matchId: matchId, partner: match.matchUser2 };
89-
} else if (match.matchUser2.id === uid) {
90-
return { matchId: matchId, partner: match.matchUser1 };
91-
}
92-
}
93-
return null;
94-
};
95-
9683
export const getMatchById = (matchId: string): Match | undefined => {
9784
return matches.get(matchId);
9885
};

backend/matching-service/src/handlers/websocketHandler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
handleMatchAccept,
44
handleMatchDelete,
55
getMatchIdByUid,
6-
getMatchByUid,
76
getMatchById,
87
} from "./matchHandler";
98
import { io } from "../server";

backend/question-service/src/app.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,6 @@ const app = express();
2121
app.use(cors({ origin: allowedOrigins, credentials: true }));
2222
app.options("*", cors({ origin: allowedOrigins, credentials: true }));
2323

24-
// To handle CORS Errors
25-
// app.use((req: Request, res: Response, next: NextFunction) => {
26-
// res.header("Access-Control-Allow-Origin", req.headers.origin); // "*" -> Allow all links to access
27-
28-
// res.header(
29-
// "Access-Control-Allow-Headers",
30-
// "Origin, X-Requested-With, Content-Type, Accept, Authorization",
31-
// );
32-
33-
// // Browsers usually send this before PUT or POST Requests
34-
// if (req.method === "OPTIONS") {
35-
// res.header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, PATCH");
36-
// return res.status(200).json({});
37-
// }
38-
39-
// // Continue Route Processing
40-
// next();
41-
// });
42-
4324
app.use(express.json());
4425
app.use("/api/questions", questionRoutes);
4526
app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));

backend/user-service/src/app.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,6 @@ app.use(express.json());
2222
app.use(cors({ origin: allowedOrigins, credentials: true })); // config cors so that front-end can use
2323
app.options("*", cors({ origin: allowedOrigins, credentials: true }));
2424

25-
// To handle CORS Errors
26-
// app.use((req: Request, res: Response, next: NextFunction) => {
27-
// res.header("Access-Control-Allow-Origin", req.headers.origin); // "*" -> Allow all links to access
28-
29-
// res.header(
30-
// "Access-Control-Allow-Headers",
31-
// "Origin, X-Requested-With, Content-Type, Accept, Authorization"
32-
// );
33-
34-
// // Browsers usually send this before PUT or POST Requests
35-
// if (req.method === "OPTIONS") {
36-
// res.header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, PATCH");
37-
// return res.status(200).json({});
38-
// }
39-
40-
// // Continue Route Processing
41-
// next();
42-
// });
43-
4425
app.use("/api/users", userRoutes);
4526
app.use("/api/auth", authRoutes);
4627
app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));

backend/user-service/tests/authRoutes.spec.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ describe("Auth routes", () => {
101101
expect(res.status).toBe(401);
102102
});
103103

104-
it("Verify token but users not found", async () => {
105-
// TODO
106-
});
107-
108104
it("Verify token", async () => {
109105
const { email, password } = await insertNonAdminUser();
110106

@@ -164,8 +160,4 @@ describe("Auth routes", () => {
164160

165161
expect(res.status).toBe(403);
166162
});
167-
168-
it("Verify if user is owner or admin", async () => {
169-
// TODO
170-
});
171163
});

frontend/src/components/Chat/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ const Chat: React.FC<ChatProps> = ({ isActive }) => {
6060

6161
return () => {
6262
communicationSocket.emit(CommunicationEvents.USER_DISCONNECT);
63-
// setMessages([]); // clear the earlier messages in dev mode
6463
};
6564
// eslint-disable-next-line react-hooks/exhaustive-deps
6665
}, []);

frontend/src/components/Layout/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const Layout: React.FC = () => {
1010
flexDirection: "column",
1111
minHeight: "100vh",
1212
minWidth: "755px",
13-
// minInlineSize: "100vw",
1413
}}
1514
>
1615
<Navbar />

frontend/src/components/Navbar/Navbar.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ beforeEach(() => {
2626
retryMatch: jest.fn(),
2727
matchingTimeout: jest.fn(),
2828
matchOfferTimeout: jest.fn(),
29-
verifyMatchStatus: jest.fn(),
29+
getMatchId: jest.fn(),
3030
matchUser: null,
3131
matchCriteria: null,
3232
partner: null,
3333
matchPending: false,
3434
loading: false,
35+
questionId: null,
36+
questionTitle: null,
3537
}));
3638
});
3739

frontend/src/components/QuestionCategoryAutoComplete/QuestionCategoryAutoComplete.test.tsx

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,6 @@ describe("Question Category Auto Complete", () => {
3838
await waitFor(() => expect(screen.getByText("DFS")).toBeInTheDocument());
3939
});
4040

41-
// it("Adding a new category not from the category list", async () => {
42-
// const { rerender } = render(
43-
// <QuestionCategoryAutoComplete
44-
// selectedCategories={selectedCategories}
45-
// setSelectedCategories={setSelectedCategories}
46-
// />
47-
// );
48-
49-
// const input = screen.getByLabelText("Category");
50-
// fireEvent.change(input, { target: { value: "New Category" } });
51-
52-
// const valueAdded = 'Add: "New Category"';
53-
// expect(await screen.findByText(valueAdded)).toBeInTheDocument();
54-
55-
// fireEvent.click(screen.getByText(valueAdded));
56-
57-
// const updatedCategories = [...selectedCategories, "New Category"];
58-
59-
// rerender(
60-
// <QuestionCategoryAutoComplete
61-
// selectedCategories={updatedCategories}
62-
// setSelectedCategories={setSelectedCategories}
63-
// />
64-
// );
65-
66-
// expect(screen.getByText("New Category")).toBeInTheDocument();
67-
// });
68-
6941
it("Remove a category from selected categories", async () => {
7042
render(
7143
<QuestionCategoryAutoComplete

frontend/src/components/QuestionCategoryAutoComplete/index.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,10 @@ const QuestionCategoryAutoComplete: React.FC<
2828
sx={{ marginTop: 2 }}
2929
value={selectedCategories}
3030
onChange={(_e, newCategoriesSelected) => {
31-
// const newValue =
32-
// newCategoriesSelected[newCategoriesSelected.length - 1];
33-
// if (typeof newValue === "string" && newValue.startsWith(`Add: "`)) {
34-
// const newCategory = newValue.slice(6, -1);
35-
// state.questionCategories.push(newCategory);
36-
// setSelectedCategories((prev) => [...prev, newCategory]);
37-
// } else {
38-
// setSelectedCategories(newCategoriesSelected);
39-
// }
4031
setSelectedCategories(newCategoriesSelected);
4132
}}
4233
filterOptions={(options, params) => {
4334
const filtered = filter(options, params);
44-
45-
// const { inputValue } = params;
46-
47-
// const isExisting = options.some((option) => inputValue === option);
48-
49-
// if (inputValue !== "" && !isExisting) {
50-
// filtered.push(`Add: "${inputValue}"`);
51-
// }
52-
5335
return filtered;
5436
}}
5537
renderTags={(value, getTagProps) =>

0 commit comments

Comments
 (0)