mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
added MAX_ITEM_QUALITY in constants file and referred it
This commit is contained in:
parent
e44c0a1d18
commit
f6a3a6d718
@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
A const to hold the names of the items
|
||||
*/
|
||||
@ -8,4 +7,6 @@ const ItemNames = {
|
||||
SULFURAS: "Sulfuras, Hand of Ragnaros",
|
||||
};
|
||||
|
||||
export { ItemNames };
|
||||
const MAX_ITEM_QUALITY = 50;
|
||||
|
||||
export { ItemNames, MAX_ITEM_QUALITY };
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { ItemNames } from "./constants";
|
||||
|
||||
import { ItemNames, MAX_ITEM_QUALITY } from "./constants";
|
||||
|
||||
export class Item {
|
||||
name: string;
|
||||
@ -32,16 +31,16 @@ export class GildedRose {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (item.quality < 50) {
|
||||
if (item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
if (item.name == ItemNames.BACKSTAGE_PASSES) {
|
||||
if (item.sellIn < 11) {
|
||||
if (item.quality < 50) {
|
||||
if (item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
}
|
||||
}
|
||||
if (item.sellIn < 6) {
|
||||
if (item.quality < 50) {
|
||||
if (item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
}
|
||||
}
|
||||
@ -63,7 +62,7 @@ export class GildedRose {
|
||||
item.quality = item.quality - item.quality;
|
||||
}
|
||||
} else {
|
||||
if (item.quality < 50) {
|
||||
if (item.quality < MAX_ITEM_QUALITY) {
|
||||
item.quality = item.quality + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user