Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diligent academy frontend challenge #4

Merged
merged 11 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
take-home-assessment-prototype.iml
.idea/
30 changes: 30 additions & 0 deletions diligent-academy-assessments/backend/coding-challenge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Coding challenge

## How to use

- Use `npm test` to check your work. This command runs the tests in watch mode, so you do not need to rerun it when you change your code.

## Principles and rules

- You can change code in the `src/implementations` folder.
- **Do not modify anything in the `src/sealed` and `test` folders.**

## Tasks

Implement the methods in the `user.js` file.

The `User` class has the following methods:

- `borrow(book, library)` - This method should add the book to the user's borrowed books list, and
remove the book from the library's available books list.


- `hasBook(book)` - This method should return a boolean if the user has the book borrowed.


- `return(book, library)` - This method should remove the book from the user's borrowed books list,
and
add the book to the library's available books list. It should return true if the book was successfully returned, and false if the user does not have the book borrowed.


- `getBookNames()` - This method should return the list of names of the books the user has borrowed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { presets: ["@babel/preset-env"] };
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
transform: {
"^.+\\.(js|jsx)$": "babel-jest",
},
};
Loading