mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 23:41:27 +00:00
Mock item
This commit is contained in:
parent
92b6f1df15
commit
51316a82c5
@ -1,8 +1,13 @@
|
|||||||
var { Shop, Item } = require('../src/gilded_rose.js');
|
var { Shop } = require('../src/gilded_rose.js');
|
||||||
describe("Gilded Rose", function () {
|
|
||||||
|
|
||||||
|
describe("Gilded Rose", function () {
|
||||||
|
let item = {
|
||||||
|
name: 'foo',
|
||||||
|
sellIn: 5,
|
||||||
|
quality: 5
|
||||||
|
}
|
||||||
it("should foo", function () {
|
it("should foo", function () {
|
||||||
const gildedRose = new Shop([new Item("foo", 0, 0)]);
|
const gildedRose = new Shop([item]);
|
||||||
const items = gildedRose.updateQuality();
|
const items = gildedRose.updateQuality();
|
||||||
expect(items[0].name).toEqual("foo");
|
expect(items[0].name).toEqual("foo");
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,13 +1,5 @@
|
|||||||
class Item {
|
|
||||||
constructor(name, sellIn, quality){
|
|
||||||
this.name = name;
|
|
||||||
this.sellIn = sellIn;
|
|
||||||
this.quality = quality;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Shop {
|
class Shop {
|
||||||
constructor(items=[]){
|
constructor(items = []) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
updateQuality() {
|
updateQuality() {
|
||||||
@ -61,6 +53,5 @@ class Shop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Item,
|
|
||||||
Shop
|
Shop
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user