Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created February 6, 2020 11:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jasongorman/f3a7e57557fd683be71b6d9612cde8fc to your computer and use it in GitHub Desktop.
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