From 7a28e75a8c6d765c3e22e8ae4535ad463ef6572a Mon Sep 17 00:00:00 2001 From: hah8236 Date: Tue, 2 Apr 2024 10:53:44 -0400 Subject: [PATCH 1/2] user routes tests --- back-end/tests/test.js | 34 +++++++++++++++++++++++++++++-- front-end/src/pages/BookSearch.js | 10 ++------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/back-end/tests/test.js b/back-end/tests/test.js index fc1c1bc..ee69dd0 100644 --- a/back-end/tests/test.js +++ b/back-end/tests/test.js @@ -22,6 +22,7 @@ describe('Name', () => { */ describe("Login & Signup", () => { + // successful login - TODO : failing describe("Successful login of an existing user", () => { it("should log in existing user", (done) => { @@ -104,7 +105,7 @@ describe("Book Routes", () => { }); }); -describe("Friends", () => { +describe("Friends Routes", () => { describe("Friend Shelf Route", () => { it("should display friends", (done) => { chai @@ -118,7 +119,7 @@ describe("Friends", () => { }); }); - describe("Friends Route", () => { +describe("Friends Route", () => { it("Friends Page Route", (done) => { chai .request(app) @@ -131,3 +132,32 @@ describe("Friends", () => { }); }); }); + +describe("User Routes", () => { + describe ("Gets all users", () => { + it("should get all users", (done) => { + chai + .request(app) + .get("/users") + .send() + .end((err, res) => { + expect(res).to.have.status(200); + expect(res.body).to.be.an("array"); + done(); + }); + }); + }); + + describe("Gets users by their id", () => { + it("should get user by their id", (done) => { + chai + .request(app) + .get("/users/1") + .end((err, res) => { + expect(res).to.have.status(200); + expect(res.body).to.be.an("object"); + done(); + }); + }); + }); +}); \ No newline at end of file diff --git a/front-end/src/pages/BookSearch.js b/front-end/src/pages/BookSearch.js index 030c06f..476bc0f 100644 --- a/front-end/src/pages/BookSearch.js +++ b/front-end/src/pages/BookSearch.js @@ -9,8 +9,7 @@ const BookSearchPage = ({ onSearch }) => { const handleSearch = (searchTerm) => { - - // Call the API to search for books + // Call the API to search for books const searchUrl =`http://localhost:3001/books/${searchTerm}`; fetch(searchUrl) .then((response) => response.json()) @@ -30,12 +29,7 @@ const BookSearchPage = ({ onSearch }) => { - - - - - - + ); }; From 02e9fc812f1bbb8c030feb327d2638765a06b1e3 Mon Sep 17 00:00:00 2001 From: hah8236 Date: Tue, 2 Apr 2024 11:38:42 -0400 Subject: [PATCH 2/2] stack login and signup on home page --- front-end/src/pages/home.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front-end/src/pages/home.js b/front-end/src/pages/home.js index 73c2aab..4162675 100644 --- a/front-end/src/pages/home.js +++ b/front-end/src/pages/home.js @@ -13,8 +13,9 @@ const Home = ({ loggedInUser }) => {
Welcome
to readTrack!
+
-
+
{loggedInUser ? (