add sorting and filtering localStorage helper functions,

add new unit tests for new helper functions

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu
2022-11-26 15:37:48 -08:00
parent 4c649e7770
commit 9ff58a1c2c
3 changed files with 219 additions and 6 deletions

View File

@@ -75,4 +75,22 @@ export function getAllReviewsFromStorage() {
reviews.push(currReview);
}
return reviews;
}
/**
* Returns the top n reviews by ID. If there are less than n reviews, returns the most possible.
* @param {number} n number of reviews to return
* @returns {Object} list of n reviews that are the top rated
*/
export function getTopReviewsFromStorage(n) {
}
/**
* Returns all reviews which contain the same tag specified.
* @param {string} tag to filter by
* @returns {Object} list of reviews that all contain the specified tag
*/
export function getReviewsByTag(tag) {
}