Created
February 6, 2020 11:36
-
-
Save jasongorman/f3a7e57557fd683be71b6d9612cde8fc 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
const assert = require('assert'); | |
function CD(artist, title, stock) { | |
this.stock = stock; | |
this.getStock = function () { | |
return this.stock; | |
}; | |
this.buy = function () { | |
this.stock -= 1; | |
}; | |
} | |
describe('CD Warehouse', () => { | |
it('reduces stock count by 1 of bought CD', () => { | |
const cd = new CD('Peter Gabriel', 'So', 1); | |
cd.buy(); | |
assert.equal(cd.getStock(), 0); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment