Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a sample of cataloge.books [ { _id: 1, title: Unlocking Android, isbn: 1933988673, pageCount: 416, publishedDate: { $date: 2009-04-01T00:00:00.000-0700 }, thumbnailUrl: https://s3.amazonaws.com/AKIAJC5RLADLUMVRPFDQ.book-thumb-images/ableson.jpg, shortDescription:
This is a sample of cataloge.books
[ { "_id": 1, "title": "Unlocking Android", "isbn": "1933988673", "pageCount": 416, "publishedDate": { "$date": "2009-04-01T00:00:00.000-0700" }, "thumbnailUrl": "https://s3.amazonaws.com/AKIAJC5RLADLUMVRPFDQ.book-thumb-images/ableson.jpg", "shortDescription": "Unlocking Android: A Developer's Guide provides concise..., "longDescription": "Android is an open source mobile phone..., "status": "PUBLISH", "authors": [ "W. Frank Ableson", "Charlie Collins", "Robi Sen" ], "categories": [ "Open Source", "Mobile" ] }, { "_id": 2, "title": "Android in Action, Second Edition", "isbn": "1935182722", "pageCount": 592, "publishedDate": { "$date": "2011-01-14T00:00:00.000-0800" }, "thumbnailUrl": "https://s3.amazonaws.com/AKIAJC5RLADLUMVRPFDQ.book-thumb-images/ableson2.jpg", "shortDescription": "Android in Action, Second Edition is a comprehensive tutorial for Android developers..., "longDescription": "When it comes to mobile apps, Android can do almost anything and with this book..., "status": "PUBLISH", "authors": [ "W. Frank Ableson", "Robi Sen" ], "categories": [ "Java" ] }, {1. Open the project named BooksDonation. 2. Inside the project you will find a folder called data that contains catalog.books.json 3. Create a class named BooksRepo and write the following methods shown in the table below using async-await 4. Create a test file called BooksRepo.spec.js that tests all the methods inside the BooksRepo.js. Make sure that you write all the tests using Mocha and Chai. 5. Finally create an app.js file to test BooksRepo class (no need to use mocha here) getBook(bookName) Returns the book object if it exists, otherwise null getBooksWithPageCount More ThanX(pageCount) Returns all the books that have a pageCount more than the given pageCount. Eg. If the user calls the function with pageCount-1000. It should return all the books that have pagecount >1000 Returns all the books authored by that specific author Note: some books have more than one author. You should consider those too and return them as well getAuthorBooks(author) getAuthorsBookCount() Returns a map that contains author name anda count of books their authored Eg Author Name James Ali Book Count 4 getBooksbyCatagory(category) Returns all the books of that category E.g. category Java should return all the books that are related to java You should use async/await(or promises), and other JavaScript features such as arrow functions, array functions (.map, .reduce, filter, .splice,.sort..), spread operator, object literals, and classes wherever required 1. Open the project named BooksDonation. 2. Inside the project you will find a folder called data that contains catalog.books.json 3. Create a class named BooksRepo and write the following methods shown in the table below using async-await 4. Create a test file called BooksRepo.spec.js that tests all the methods inside the BooksRepo.js. Make sure that you write all the tests using Mocha and Chai. 5. Finally create an app.js file to test BooksRepo class (no need to use mocha here) getBook(bookName) Returns the book object if it exists, otherwise null getBooksWithPageCount More ThanX(pageCount) Returns all the books that have a pageCount more than the given pageCount. Eg. If the user calls the function with pageCount-1000. It should return all the books that have pagecount >1000 Returns all the books authored by that specific author Note: some books have more than one author. You should consider those too and return them as well getAuthorBooks(author) getAuthorsBookCount() Returns a map that contains author name anda count of books their authored Eg Author Name James Ali Book Count 4 getBooksbyCatagory(category) Returns all the books of that category E.g. category Java should return all the books that are related to java You should use async/await(or promises), and other JavaScript features such as arrow functions, array functions (.map, .reduce, filter, .splice,.sort..), spread operator, object literals, and classes wherever required
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started