mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 06:21:29 +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');
|
||||
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");
|
||||
});
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user