Skip to content
Permalink
Browse files
Fix TDD tests
  • Loading branch information
Oliver Bell committed Oct 8, 2018
1 parent 44bdfca commit 7f7ae0bc5de1036f9291f1c594cb62e44d107dc4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
@@ -33,8 +33,7 @@ describe('add', () => {

const request = { body: { item: 'bread', qty: 5, cost: 54 } };
const data = list.add(request);

expect(data.item.cost).toBe(54);
expect(data.cost).toBe(54);

done();
})
@@ -6,15 +6,15 @@ let items = []
module.exports.add = request => {
const data = this.extractBodyData(request)

data.item = data.item.toLowerCase()
data.item = data.item.toLowerCase();
for (const item of items) {
if (item.item === data.item) {
item.qty = data.qty;
item.cost = data.cost;
return item;
}
}
items.push(data)
items.push(data);
return data
}

0 comments on commit 7f7ae0b

Please sign in to comment.