From 8191627ad507eee84048209bc9775f3a72181123 Mon Sep 17 00:00:00 2001 From: Vincent Tannos Date: Sat, 14 Dec 2024 11:45:57 +1100 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=97=9D=EF=B8=8F=20Add=20More=20Tests?= =?UTF-8?q?=20for=20createKeyword?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/index.ts | 2 +- backend/tests/createKeyword.test.ts | 246 +++++++++------------------- 2 files changed, 75 insertions(+), 173 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index ac877e5..f852c2e 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1182,7 +1182,7 @@ app.post( }); return res.status(200).json(newKeyword); } catch (e) { - return res.status(400).json({ message: "invalid keyword input" }); + return res.status(400).json({ message: "Invalid keyword input." }); } }); diff --git a/backend/tests/createKeyword.test.ts b/backend/tests/createKeyword.test.ts index f9dd1c8..3e53760 100644 --- a/backend/tests/createKeyword.test.ts +++ b/backend/tests/createKeyword.test.ts @@ -48,176 +48,78 @@ describe('/keyword endpoint', () => { expect(response.status).toBe(200); }); -// test('Event invalid', async () => { -// const { status, body } = await request(app).post("/auth/register").send({ -// username: "shinjisatoo", -// password: "testpassword", -// email: "longseason1996@gmail.com", -// userType: "ATTENDEE", -// }); - -// const newUser = await prisma.user.findFirst({ -// where: { -// id: body.newUser.id, -// }, -// }); - -// if (newUser == null) return; -// expect(status).toBe(201); -// expect(newUser).not.toBeNull(); - -// const loginres = await request(app).post("/auth/login").send({ -// username: "shinjisatoo", -// password: "testpassword", -// }); -// let sessionID = loginres.headers["set-cookie"]; - -// const societyRes = await request(app).post("/society/create") -// .set("Cookie", sessionID) -// .send({ -// name: "Rizzsoc", -// userId: newUser.id, -// }); - -// const socId = societyRes.body.id -// expect(societyRes.status).toBe(200); -// const start = new Date() - -// const eventRes = await request(app) -// .post("/event/create") -// .set("Cookie", sessionID) -// .send({ -// banner: "https://img-cdn.inc.com/image/upload/f_webp,q_auto,c_fit/images/panoramic/Island-Entertainment-viral-tiktok-inc_539684_hnvnix.jpg", -// name: "tiktokrizzparty", -// startDateTime: new Date(), -// endDateTime: new Date(start.getTime() + 86400000), -// location: "tampa, florida", -// description: "fein! fein! fein! fein! fein so good she honor roll", -// societyId: socId -// }); - -// const attendRes = await request(app).post("/user/event/attend") -// .set("Cookie", sessionID) -// .send({ -// eventId: -123 -// }) - -// expect(attendRes.status).toBe(400); -// }) -// }) - -// describe('/unattend endpoint', () => { -// test('Unattend successful', async () => { -// const { status, body } = await request(app).post("/auth/register").send({ -// username: "shinjisatoo", -// password: "testpassword", -// email: "longseason1996@gmail.com", -// userType: "ATTENDEE", -// }); - -// const newUser = await prisma.user.findFirst({ -// where: { -// id: body.newUser.id, -// }, -// }); - -// if (newUser == null) return; -// expect(status).toBe(201); -// expect(newUser).not.toBeNull(); - -// const loginres = await request(app).post("/auth/login").send({ -// username: "shinjisatoo", -// password: "testpassword", -// }); -// let sessionID = loginres.headers["set-cookie"]; - -// const societyRes = await request(app).post("/society/create") -// .set("Cookie", sessionID) -// .send({ -// name: "Rizzsoc", -// userId: newUser.id, -// }); - -// const socId = societyRes.body.id -// expect(societyRes.status).toBe(200); -// const start = new Date() - -// const eventRes = await request(app) -// .post("/event/create") -// .set("Cookie", sessionID) -// .send({ -// banner: "https://img-cdn.inc.com/image/upload/f_webp,q_auto,c_fit/images/panoramic/Island-Entertainment-viral-tiktok-inc_539684_hnvnix.jpg", -// name: "tiktokrizzparty", -// startDateTime: new Date(), -// endDateTime: new Date(start.getTime() + 86400000), -// location: "tampa, florida", -// description: "fein! fein! fein! fein! fein so good she honor roll", -// societyId: socId -// }); - -// const attendRes = await request(app).delete("/user/event") -// .set("Cookie", sessionID) -// .send({ -// eventId: eventRes.body.numId -// }) - -// expect(attendRes.status).toBe(200); -// }) - -// test('Event invalid', async () => { -// const { status, body } = await request(app).post("/auth/register").send({ -// username: "shinjisatoo", -// password: "testpassword", -// email: "longseason1996@gmail.com", -// userType: "ATTENDEE", -// }); - -// const newUser = await prisma.user.findFirst({ -// where: { -// id: body.newUser.id, -// }, -// }); - -// if (newUser == null) return; -// expect(status).toBe(201); -// expect(newUser).not.toBeNull(); - -// const loginres = await request(app).post("/auth/login").send({ -// username: "shinjisatoo", -// password: "testpassword", -// }); -// let sessionID = loginres.headers["set-cookie"]; - -// const societyRes = await request(app).post("/society/create") -// .set("Cookie", sessionID) -// .send({ -// name: "Rizzsoc", -// userId: newUser.id, -// }); + test('DDuplicate keyword rejected', async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const loginres = await request(app).post("/auth/login").send({ + username: "shinjisatoo", + password: "testpassword", + }); + let sessionID = loginres.headers["set-cookie"]; + + await request(app) + .post("/keyword") + .set("Cookie", sessionID) + .send({ + text: "skibidi", + }); -// const socId = societyRes.body.id -// expect(societyRes.status).toBe(200); -// const start = new Date() - -// const eventRes = await request(app) -// .post("/event/create") -// .set("Cookie", sessionID) -// .send({ -// banner: "https://img-cdn.inc.com/image/upload/f_webp,q_auto,c_fit/images/panoramic/Island-Entertainment-viral-tiktok-inc_539684_hnvnix.jpg", -// name: "tiktokrizzparty", -// startDateTime: new Date(), -// endDateTime: new Date(start.getTime() + 86400000), -// location: "tampa, florida", -// description: "fein! fein! fein! fein! fein so good she honor roll", -// societyId: socId -// }); - -// const attendRes = await request(app).delete("/user/event") -// .set("Cookie", sessionID) -// .send({ -// eventId: -123 -// }) - -// expect(attendRes.status).toBe(400); -// }) -}) \ No newline at end of file + const response = await request(app) + .post("/keyword") + .set("Cookie", sessionID) + .send({ + text: "skibidi", + }); + + expect(response.status).toBe(400); + expect(response.body.message).toBe("Keyword already exists."); + }); + + test('Invalid keyword input', async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const loginres = await request(app).post("/auth/login").send({ + username: "shinjisatoo", + password: "testpassword", + }); + let sessionID = loginres.headers["set-cookie"]; + + const response = await request(app) + .post("/keyword") + .set("Cookie", sessionID) + .send({ + text: "", + }); + + expect(response.status).toBe(400); + expect(response.body.message).toBe("Invalid input."); + }); +}); \ No newline at end of file From 37bac15a6cc8a60fa776a5fc709d46ceb25f6df7 Mon Sep 17 00:00:00 2001 From: Vincent Tannos Date: Sat, 14 Dec 2024 23:29:08 +1100 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=97=9D=EF=B8=8F=20Add=20Tests=20and?= =?UTF-8?q?=20Implement=20userKeywords=20Routes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/index.ts | 128 ++++++++++++- backend/src/requestTypes.ts | 4 + backend/tests/userKeywords.test.ts | 276 +++++++++++++++++++++++++++++ 3 files changed, 400 insertions(+), 8 deletions(-) create mode 100644 backend/tests/userKeywords.test.ts diff --git a/backend/src/index.ts b/backend/src/index.ts index f852c2e..2b20137 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -12,6 +12,7 @@ import { RegisterBody, UpdateEventBody, CreateKeywordBody, + keywordIdBody, } from "./requestTypes"; import bcrypt from "bcrypt"; import { LoginErrors, SanitisedUser } from "./interfaces"; @@ -1133,18 +1134,18 @@ app.get( const userID = sessionFromDB.userId; - const userKeywords = await prisma.user.findFirst({ + let userKeywords = await prisma.user.findFirst({ where: { id: userID, }, select: { - keywords: { - select: {text: true} - }, + keywords: true, } - }) + }); + + if (userKeywords === null) return res.status(200).json([]); - return res.status(200).json(userKeywords); + return res.status(200).json(userKeywords.keywords); }); // creates a keyword @@ -1186,8 +1187,119 @@ app.post( } }); -// - app.post("/user/keyword") - Associates a user with a keyword -// - app.delete("/user/keyword") - Disassociates a user with a keyword +// associates a user with a keyword +app.post( + "/user/keyword", + async (req: TypedRequest, res: Response) => { + //get userid from session + const sessionFromDB = await validateSession( + req.session ? req.session : null + ); + if (!sessionFromDB) { + return res.status(401).json({ message: "Invalid session provided." }); + } + const userID = sessionFromDB.userId; + + //Make sure keyword exists + const keywordExists = await prisma.keyword.findFirst({ + where: { + id: req.body.keywordId, + }, + select: { + id: true, + }, + }); + + if (!keywordExists) { + return res.status(400).json({ message: "Invalid keyword." }); + } + + //Connect keyword and user + await prisma.keyword.update({ + where: { + id: req.body.keywordId, + }, + data: { + subscribers: { + connect: { + id: userID, + }, + }, + }, + }); + + await prisma.user.update({ + where: { + id: userID, + }, + data: { + keywords: { + connect: { + id: req.body.keywordId, + }, + }, + }, + }); + + return res.status(200).json({ message: "ok" }); +}); + +// disassociates a user with a keyword +app.delete( + "/user/keyword", + async (req: TypedRequest, res: Response) => { + //get userid from session + const sessionFromDB = await validateSession( + req.session ? req.session : null + ); + if (!sessionFromDB) { + return res.status(401).json({ message: "Invalid session provided." }); + } + const userID = sessionFromDB.userId; + + //Make sure keyword exists + const societyId = await prisma.keyword.findFirst({ + where: { + id: req.body.keywordId, + }, + select: { + id: true, + }, + }); + + if (!societyId) { + return res.status(400).json({ message: "Invalid keyword." }); + } + + //Disconnect keyword and user + await prisma.keyword.update({ + where: { + id: req.body.keywordId, + }, + data: { + subscribers: { + disconnect: { + id: userID, + }, + }, + }, + }); + + await prisma.user.update({ + where: { + id: userID, + }, + data: { + keywords: { + disconnect: { + id: req.body.keywordId, + }, + }, + }, + }); + + return res.status(200).json({ message: "ok" }); +}); app.get("/hello", () => { console.log("Hello World!"); diff --git a/backend/src/requestTypes.ts b/backend/src/requestTypes.ts index 1d3c637..c2702a0 100644 --- a/backend/src/requestTypes.ts +++ b/backend/src/requestTypes.ts @@ -59,4 +59,8 @@ export interface eventIdBody { eventId: number; } +export interface keywordIdBody { + keywordId: number; +} + export interface eventDetailsBody {} diff --git a/backend/tests/userKeywords.test.ts b/backend/tests/userKeywords.test.ts new file mode 100644 index 0000000..1d30ccd --- /dev/null +++ b/backend/tests/userKeywords.test.ts @@ -0,0 +1,276 @@ +import { expect, test, vi, describe } from "vitest"; // 👈🏻 Added the `vi` import +import prisma from "../src/prisma"; +import request from "supertest"; +import app from "../src/index"; +import { beforeEach } from "node:test"; + +describe("POST /user/keyword endpoint", () => { + test("Keyword successfully associated", async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const response = await request(app).post("/auth/login").send({ + username: newUser.username, + password: "testpassword", + }); + + expect(response.status).toBe(200); + + const sessionID = response.headers["set-cookie"]; + + const keywordRes = await request(app) + .post("/keyword") + .set("Cookie", sessionID) + .send({ + text: "skibidi", + }); + + expect(keywordRes.status).toBe(200); + + const res = await request(app) + .post("/user/keyword") + .set("Cookie", sessionID) + .send({ + keywordId: keywordRes.body.id, + }); + expect(res.status).toBe(200); + }); + + test("Keyword doesn't exist", async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const response = await request(app).post("/auth/login").send({ + username: newUser.username, + password: "testpassword", + }); + + expect(response.status).toBe(200); + + const sessionID = response.headers["set-cookie"]; + + const res = await request(app) + .post("/user/keyword") + .set("Cookie", sessionID) + .send({ + keywordId: -230, + }); + expect(res.status).toBe(400); + expect(res.body.message).toBe("Invalid keyword."); + }); +}); + +describe("DELETE /user/keyword endpoint", () => { + test("Keyword successfully disassociated", async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const response = await request(app).post("/auth/login").send({ + username: newUser.username, + password: "testpassword", + }); + + expect(response.status).toBe(200); + + const sessionID = response.headers["set-cookie"]; + + const keywordRes = await request(app) + .post("/keyword") + .set("Cookie", sessionID) + .send({ + text: "mfw", + }); + + expect(keywordRes.status).toBe(200); + + await request(app) + .post("/user/keyword") + .set("Cookie", sessionID) + .send({ + keywordId: keywordRes.body.id, + }); + + const res = await request(app) + .delete("/user/keyword") + .set("Cookie", sessionID) + .send({ + keywordId: keywordRes.body.id, + }); + expect(res.status).toBe(200); + }); + + test("Keyword doesn't exist", async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const response = await request(app).post("/auth/login").send({ + username: newUser.username, + password: "testpassword", + }); + + expect(response.status).toBe(200); + + const sessionID = response.headers["set-cookie"]; + + const res = await request(app) + .delete("/user/keyword") + .set("Cookie", sessionID) + .send({ + keywordId: -230, + }); + expect(res.status).toBe(400); + expect(res.body.message).toBe("Invalid keyword."); + }); +}); + +describe("/user/keywords endpoint", () => { + test("Multiple keywords successfully listed", async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const response = await request(app).post("/auth/login").send({ + username: newUser.username, + password: "testpassword", + }); + + expect(response.status).toBe(200); + + const sessionID = response.headers["set-cookie"]; + + // add and link keyword 1 + let keywordRes = await request(app) + .post("/keyword") + .set("Cookie", sessionID) + .send({ + text: "skibidi1", + }); + + await request(app) + .post("/user/keyword") + .set("Cookie", sessionID) + .send({ + keywordId: keywordRes.body.id, + }); + + // add and link keyword 2 + keywordRes = await request(app) + .post("/keyword") + .set("Cookie", sessionID) + .send({ + text: "toilet", + }); + + await request(app) + .post("/user/keyword") + .set("Cookie", sessionID) + .send({ + keywordId: keywordRes.body.id, + }); + + const res = await request(app) + .get("/user/keywords") + .set("Cookie", sessionID); + expect(res.status).toBe(200); + expect(res.body.length).toBe(2); + expect(res.body.map((x) => x.text)).toContain('skibidi1'); + expect(res.body.map((x) => x.text)).toContain('toilet'); + }); + + test("Zero keywords successfully listed", async () => { + const { status, body } = await request(app).post("/auth/register").send({ + username: "shinjisatoo", + password: "testpassword", + email: "longseason1996@gmail.com", + }); + + const newUser = await prisma.user.findFirst({ + where: { + id: body.newUser.id, + }, + }); + + if (newUser == null) return; + expect(status).toBe(201); + expect(newUser).not.toBeNull(); + + const response = await request(app).post("/auth/login").send({ + username: newUser.username, + password: "testpassword", + }); + + expect(response.status).toBe(200); + + const sessionID = response.headers["set-cookie"]; + + const res = await request(app) + .get("/user/keywords") + .set("Cookie", sessionID) + expect(res.status).toBe(200); + expect(res.body.length).toBe(0); + }); +}); From 0186ed50fffe3d86be65b88e4a6a93973f8973ee Mon Sep 17 00:00:00 2001 From: Vincent Tannos Date: Sun, 15 Dec 2024 00:31:52 +1100 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=97=9D=EF=B8=8F=20Change=20Status=20C?= =?UTF-8?q?odes=20for=20userKeywords=20Routes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/index.ts | 4 ++-- backend/tests/createKeyword.test.ts | 5 ++--- backend/tests/userKeywords.test.ts | 25 ++++++++++++++++--------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index ee5a896..e284c32 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -1172,7 +1172,7 @@ app.get('/user/keywords', async (req, res: Response) => { } }); - if (userKeywords === null) return res.status(200).json([]); + if (userKeywords === null) return res.status(404).json([]); return res.status(200).json(userKeywords.keywords); }); @@ -1241,7 +1241,7 @@ app.post( }); if (!keywordExists) { - return res.status(400).json({ message: "Invalid keyword." }); + return res.status(404).json({ message: "Invalid keyword." }); } //Connect keyword and user diff --git a/backend/tests/createKeyword.test.ts b/backend/tests/createKeyword.test.ts index 3e53760..dca78bb 100644 --- a/backend/tests/createKeyword.test.ts +++ b/backend/tests/createKeyword.test.ts @@ -42,13 +42,12 @@ describe('/keyword endpoint', () => { .post("/keyword") .set("Cookie", sessionID) .send({ - text: "skibidi toilet yes yes ghvsbdkakbhf", + text: "skibidi toilet yes", }); - expect(response.status).toBe(200); }); - test('DDuplicate keyword rejected', async () => { + test('Duplicate keyword rejected', async () => { const { status, body } = await request(app).post("/auth/register").send({ username: "shinjisatoo", password: "testpassword", diff --git a/backend/tests/userKeywords.test.ts b/backend/tests/userKeywords.test.ts index 1d30ccd..20761cc 100644 --- a/backend/tests/userKeywords.test.ts +++ b/backend/tests/userKeywords.test.ts @@ -35,9 +35,10 @@ describe("POST /user/keyword endpoint", () => { .post("/keyword") .set("Cookie", sessionID) .send({ - text: "skibidi", + text: "skibidi12", }); - + + console.log(keywordRes.body); expect(keywordRes.status).toBe(200); const res = await request(app) @@ -81,7 +82,8 @@ describe("POST /user/keyword endpoint", () => { .send({ keywordId: -230, }); - expect(res.status).toBe(400); + console.log(res.body); + expect(res.status).toBe(404); expect(res.body.message).toBe("Invalid keyword."); }); }); @@ -117,7 +119,7 @@ describe("DELETE /user/keyword endpoint", () => { .post("/keyword") .set("Cookie", sessionID) .send({ - text: "mfw", + text: "mfw2", }); expect(keywordRes.status).toBe(200); @@ -207,9 +209,11 @@ describe("/user/keywords endpoint", () => { .post("/keyword") .set("Cookie", sessionID) .send({ - text: "skibidi1", + text: "skibidi59", }); + expect(keywordRes.status).toBe(200); + await request(app) .post("/user/keyword") .set("Cookie", sessionID) @@ -222,8 +226,10 @@ describe("/user/keywords endpoint", () => { .post("/keyword") .set("Cookie", sessionID) .send({ - text: "toilet", + text: "toilet39", }); + + expect(keywordRes.status).toBe(200); await request(app) .post("/user/keyword") @@ -237,8 +243,8 @@ describe("/user/keywords endpoint", () => { .set("Cookie", sessionID); expect(res.status).toBe(200); expect(res.body.length).toBe(2); - expect(res.body.map((x) => x.text)).toContain('skibidi1'); - expect(res.body.map((x) => x.text)).toContain('toilet'); + expect(res.body.map((x) => x.text)).toContain('skibidi59'); + expect(res.body.map((x) => x.text)).toContain('toilet39'); }); test("Zero keywords successfully listed", async () => { @@ -270,7 +276,8 @@ describe("/user/keywords endpoint", () => { const res = await request(app) .get("/user/keywords") .set("Cookie", sessionID) - expect(res.status).toBe(200); + console.log(res.body); + expect(res.status).toBe(404); expect(res.body.length).toBe(0); }); }); From 8b7abdb299b2e755a70d04ff2c07078dde81d298 Mon Sep 17 00:00:00 2001 From: Vincent Tannos Date: Sun, 15 Dec 2024 00:49:07 +1100 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=97=9D=EF=B8=8F=20Fix=20Database=20No?= =?UTF-8?q?t=20Flushing=20Data=20Problem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/tests/helpers/reset-db.ts | 3 +++ backend/tests/userKeywords.test.ts | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/tests/helpers/reset-db.ts b/backend/tests/helpers/reset-db.ts index 47c7e4b..eea5945 100644 --- a/backend/tests/helpers/reset-db.ts +++ b/backend/tests/helpers/reset-db.ts @@ -11,6 +11,9 @@ let redisClient = createClient({ export default async () => { await redisClient.connect(); await prisma.user.deleteMany(); + await prisma.society.deleteMany(); + await prisma.event.deleteMany(); + await prisma.keyword.deleteMany(); await redisClient.flushDb(); await redisClient.quit(); }; diff --git a/backend/tests/userKeywords.test.ts b/backend/tests/userKeywords.test.ts index 20761cc..c676bed 100644 --- a/backend/tests/userKeywords.test.ts +++ b/backend/tests/userKeywords.test.ts @@ -38,7 +38,6 @@ describe("POST /user/keyword endpoint", () => { text: "skibidi12", }); - console.log(keywordRes.body); expect(keywordRes.status).toBe(200); const res = await request(app) @@ -82,7 +81,6 @@ describe("POST /user/keyword endpoint", () => { .send({ keywordId: -230, }); - console.log(res.body); expect(res.status).toBe(404); expect(res.body.message).toBe("Invalid keyword."); }); @@ -276,8 +274,7 @@ describe("/user/keywords endpoint", () => { const res = await request(app) .get("/user/keywords") .set("Cookie", sessionID) - console.log(res.body); - expect(res.status).toBe(404); + expect(res.status).toBe(200); expect(res.body.length).toBe(0); }); });