diff --git a/js-jest/src/gilded_rose.js b/js-jest/src/gilded_rose.js index 48746965..6cb6f773 100644 --- a/js-jest/src/gilded_rose.js +++ b/js-jest/src/gilded_rose.js @@ -6,6 +6,16 @@ class Item { } } +class ItemUpdater { + constructor(item) { + this.item = item; + } + + updateQuality() { + return this.item; + } +} + class Shop { constructor(items=[]){ this.items = items; @@ -63,5 +73,6 @@ class Shop { module.exports = { Item, - Shop + Shop, + ItemUpdater } diff --git a/js-jest/test/gilded_rose.test.js b/js-jest/test/gilded_rose.test.js index c8e0e3d7..027d1edc 100644 --- a/js-jest/test/gilded_rose.test.js +++ b/js-jest/test/gilded_rose.test.js @@ -1,9 +1,17 @@ -const {Shop, Item} = require("../src/gilded_rose"); +const {Shop, Item, ItemUpdater} = require("../src/gilded_rose"); describe("Gilded Rose", function() { it("should foo", function() { const gildedRose = new Shop([new Item("foo", 0, 0)]); const items = gildedRose.updateQuality(); - expect(items[0].name).toBe("fixme"); + expect(items[0].name).toBe("foo"); + }); +}); + +describe("Gilded Rose check common rules", function () { + it("should foo", function () { + const gildedRose = new ItemUpdater(new Item("Aged Brie", 10, 0)); + const item = gildedRose.updateQuality(); + expect(item.quality).toBe(10); }); });