Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created July 27, 2019 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/829643d4ca0684c826ee37269c32a765 to your computer and use it in GitHub Desktop.
Save jasongorman/829643d4ca0684c826ee37269c32a765 to your computer and use it in GitHub Desktop.
describe('When a label sends a batch of multiple CDs', function(){
it('adds all the received copies to the stock of all received CDs', function(){
const meatloaf = new CD(0, 10, new Description('Bat Out Of Hell', 'Meatloaf'));
const catalogue = new Catalogue(contents=[meatloaf], new CdFactory());
const warehouse = new Warehouse(catalogue);
const batch = {
cds: [
{
title: 'Bat Out Of Hell',
artist: 'Meatloaf',
copies: 10,
price: 9.99
},
{
title: 'So Red The Rose',
artist: 'Arcadia',
copies: 10,
price: 9.99
}
]
}
warehouse.receive(batch);
assert.equal(meatloaf.stock, 20);
assert.equal(catalogue.search('So Red The Rose', 'Arcadia').stock, 10);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment