Mock item

This commit is contained in:
Dan Holmes 2020-12-03 12:00:23 +00:00
parent 92b6f1df15
commit 51316a82c5
2 changed files with 9 additions and 13 deletions

View File

@ -1,8 +1,13 @@
var { Shop, Item } = require('../src/gilded_rose.js');
describe("Gilded Rose", function () {
var { Shop } = require('../src/gilded_rose.js');
describe("Gilded Rose", function () {
let item = {
name: 'foo',
sellIn: 5,
quality: 5
}
it("should foo", function () {
const gildedRose = new Shop([new Item("foo", 0, 0)]);
const gildedRose = new Shop([item]);
const items = gildedRose.updateQuality();
expect(items[0].name).toEqual("foo");
});

View File

@ -1,13 +1,5 @@
class Item {
constructor(name, sellIn, quality){
this.name = name;
this.sellIn = sellIn;
this.quality = quality;
}
}
class Shop {
constructor(items=[]){
constructor(items = []) {
this.items = items;
}
updateQuality() {
@ -61,6 +53,5 @@ class Shop {
}
}
module.exports = {
Item,
Shop
}