mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Add conjured items
This commit is contained in:
parent
9234534172
commit
fa105c7c35
@ -99,5 +99,23 @@ describe('Shop', () => {
|
|||||||
expect(items[0].quality).toEqual(0);
|
expect(items[0].quality).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Conjured', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
item.name = 'Conjured pickle';
|
||||||
|
});
|
||||||
|
it('will decrease the quality by 2 before sell by', () => {
|
||||||
|
item.sellIn = 5;
|
||||||
|
item.quality = 5;
|
||||||
|
const items = gildedRose.updateQuality();
|
||||||
|
expect(items[0].quality).toEqual(5 - 2);
|
||||||
|
});
|
||||||
|
it('will decrease the quality by 4 after sell by', () => {
|
||||||
|
item.sellIn = 0;
|
||||||
|
item.quality = 5;
|
||||||
|
const items = gildedRose.updateQuality();
|
||||||
|
expect(items[0].quality).toEqual(5 - 4);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
8
js-jasmine/src/item_types/conjured_update.js
Normal file
8
js-jasmine/src/item_types/conjured_update.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
exports.regex_matcher = /conjured/;
|
||||||
|
exports.qualityChange = function (sellIn, quality) {
|
||||||
|
if (sellIn <= 0) {
|
||||||
|
return -4;
|
||||||
|
} else {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user