mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Writing test case for genaric items without logic. - Test driven development
This commit is contained in:
parent
74291a62a6
commit
dfda89c474
@ -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
|
||||
}
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user