GildedRose-Refactoring-Kata/js-jest/src/item_updaters/conjured_updater.js
2021-09-19 09:33:07 +05:30

22 lines
524 B
JavaScript

const { ItemUpdater } = require("../gilded_rose");
class ConjuredUpdater extends ItemUpdater {
updateQuality() {
this.qualityChangeFactor = 2;
//The Quality of an item is never more than 50
if (this.item.quality > 50) {
this.item.quality = 50;
}
if (this.item.quality > 0 && this.item.quality < 50) {
this.item.quality = this.item.quality - this.qualityChangeFactor;
}
return this.item;
}
}
module.exports = {
ConjuredUpdater
}