Skip to content

Commit

Permalink
Merge pull request #102 from agiledev-students-spring2024/hannah
Browse files Browse the repository at this point in the history
user route tests and home page visual changes
  • Loading branch information
k1arac authored Apr 4, 2024
2 parents 0b0ac90 + b7c5ff5 commit 0c36311
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
32 changes: 31 additions & 1 deletion back-end/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -104,7 +105,7 @@ describe("Book Routes", () => {
});
});

describe("Friends", () => {
describe("Friends Routes", () => {
describe("Friend Shelf Route", () => {
it("should display friends", (done) => {
chai
Expand All @@ -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();
});
});
});
});
10 changes: 2 additions & 8 deletions front-end/src/pages/BookSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -30,12 +29,7 @@ const BookSearchPage = ({ onSearch }) => {

<SearchComponent onSearch={handleSearch} />
<BookShelf title="Search Results" books={books} />







</div>
);
};
Expand Down
3 changes: 2 additions & 1 deletion front-end/src/pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const Home = ({ loggedInUser }) => {
</div>
<div className="text-goodreads-darkbrown">Welcome</div>
<div className="text-2xl text-goodreads-brown">to readTrack!</div>
<div className="mt-4"></div>
</div>
<div className="flex space-x-4">
<div className="flex flex-col space-y-4">
{loggedInUser ? (
<input
className="btn"
Expand Down

0 comments on commit 0c36311

Please sign in to comment.