Created
July 31, 2019 08:00
-
-
Save jasongorman/32d5a0162aadffd6e7fbe527219e00f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Average rating', function(){ | |
it('calculates the average of ratings in all reviews for a CD', function(){ | |
const cd = new CD(0,0, new Description('Obzen', 'Meshuggah')); | |
const jason = new Customer('Jason'); | |
jason.addToCollection(cd); | |
const review1 = new Review(jason, rating=5); | |
const jane = new Customer('Jane'); | |
jane.addToCollection(cd); | |
const review2 = new Review(jane, rating=4); | |
cd.leaveReview(review1); | |
cd.leaveReview(review2); | |
assert.equal(cd.averageRating(), 4.5); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment