mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
add jest + TU to snapshot previous behavior
This commit is contained in:
parent
864f34ccc1
commit
bad7c901ea
2
TypeScript/.eslintignore
Normal file
2
TypeScript/.eslintignore
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules/**
|
||||
**/*.js
|
||||
5
TypeScript/.eslintrc
Normal file
5
TypeScript/.eslintrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"extends": ["plugin:@typescript-eslint/recommended"]
|
||||
}
|
||||
2
TypeScript/.nvmrc
Normal file
2
TypeScript/.nvmrc
Normal file
@ -0,0 +1,2 @@
|
||||
v16.6.1
|
||||
|
||||
2
TypeScript/.prettierignore
Normal file
2
TypeScript/.prettierignore
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules/**
|
||||
**/*.js
|
||||
10
TypeScript/.prettierrc
Normal file
10
TypeScript/.prettierrc
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"semi": false,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 100,
|
||||
"useTabs": false,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"arrowParens": "avoid",
|
||||
"proseWrap": "preserve"
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
export class Item {
|
||||
name: string;
|
||||
sellIn: number;
|
||||
quality: number;
|
||||
|
||||
constructor(name, sellIn, quality) {
|
||||
this.name = name;
|
||||
this.sellIn = sellIn;
|
||||
this.quality = quality;
|
||||
}
|
||||
}
|
||||
|
||||
export class GildedRose {
|
||||
items: Array<Item>;
|
||||
|
||||
constructor(items = [] as Array<Item>) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
updateQuality() {
|
||||
for (let i = 0; i < this.items.length; i++) {
|
||||
if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (this.items[i].quality > 0) {
|
||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
this.items[i].quality = this.items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (this.items[i].sellIn < 11) {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
}
|
||||
}
|
||||
if (this.items[i].sellIn < 6) {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
this.items[i].sellIn = this.items[i].sellIn - 1;
|
||||
}
|
||||
if (this.items[i].sellIn < 0) {
|
||||
if (this.items[i].name != 'Aged Brie') {
|
||||
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (this.items[i].quality > 0) {
|
||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
||||
this.items[i].quality = this.items[i].quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.items[i].quality = this.items[i].quality - this.items[i].quality
|
||||
}
|
||||
} else {
|
||||
if (this.items[i].quality < 50) {
|
||||
this.items[i].quality = this.items[i].quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
7
TypeScript/jest.config.js
Normal file
7
TypeScript/jest.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
roots: ["<rootDir>/src"],
|
||||
testMatch: ["**/__tests__/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"],
|
||||
transform: {
|
||||
"^.+\\.(ts|tsx)$": "ts-jest",
|
||||
},
|
||||
};
|
||||
@ -2,40 +2,35 @@
|
||||
"name": "gilded-rose-kata",
|
||||
"version": "1.0.0",
|
||||
"description": "Gilded Rose kata in TypeScript",
|
||||
"scripts": {
|
||||
"precompile": "rimraf app/**/*.js test/**/*.js",
|
||||
"compile": "tsc",
|
||||
"pretest": "rimraf app/**/*.js test/**/*.js",
|
||||
"test": "nyc mocha"
|
||||
},
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@types/chai": "~3.5.2",
|
||||
"@types/mocha": "~2.2.41",
|
||||
"@types/node": "~7.0.18",
|
||||
"chai": "~4.2.0",
|
||||
"mocha": "~8.2.1",
|
||||
"nyc": "~15.1.0",
|
||||
"rimraf": "~3.0.2",
|
||||
"source-map-support": "0.5.19",
|
||||
"ts-node": "~9.1.1",
|
||||
"typescript": "~4.1.3"
|
||||
"dependencies": {
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/node": "^16.4.13",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
||||
"@typescript-eslint/parser": "^4.29.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"jest": "^27.0.6",
|
||||
"lint-staged": "^11.1.2",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^27.0.4",
|
||||
"ts-loader": "^9.2.5",
|
||||
"typescript": "^4.3.5",
|
||||
"webpack": "^5.49.0",
|
||||
"webpack-cli": "^4.7.2"
|
||||
},
|
||||
"nyc": {
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"exclude": [
|
||||
"**/*.d.ts",
|
||||
"test/**"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"reporter": [
|
||||
"html",
|
||||
"text"
|
||||
"lint-staged": {
|
||||
"**/*.ts": [
|
||||
"eslint src/** --fix --ext",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production webpack",
|
||||
"test": "jest",
|
||||
"format:fix": "eslint src/** --fix",
|
||||
"format:check": "eslint src/**"
|
||||
}
|
||||
}
|
||||
|
||||
41
TypeScript/src/README.md
Normal file
41
TypeScript/src/README.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Spécification de la Rose dorée (Gilded Rose)
|
||||
|
||||
Bonjour et bienvenue dans l'équipe de la Rose dorée.
|
||||
|
||||
Comme vous le savez, notre petite taverne située à proximité d'une cité importante est dirigée par l'amicale aubergiste Allison.
|
||||
|
||||
Nous achetons et vendons uniquement les meilleurs produits.
|
||||
Malheureusement, la qualité de nos marchandises se dégrade constamment à l'approche de leur date de péremption.
|
||||
|
||||
Un système a été mis en place pour mettre à jour notre inventaire.
|
||||
Il a été développé par Leeroy, une personne pleine de bon sens qui est partie pour de nouvelles aventures.
|
||||
|
||||
Votre mission est d'ajouter une nouvelle fonctionnalité à notre système pour que nous puissions commencer à vendre un nouveau type de produits.
|
||||
|
||||
Mais d'abord, laissez-moi vous présenter notre système :
|
||||
|
||||
- Tous les éléments ont une valeur `sellIn` qui désigne le nombre de jours restant pour vendre l'article.
|
||||
- Tous les articles ont une valeur `quality` qui dénote combien l'article est précieux.
|
||||
- À la fin de chaque journée, notre système diminue ces deux valeurs pour chaque produit.
|
||||
|
||||
Plutôt simple, non ?
|
||||
|
||||
Attendez, ça devient intéressant :
|
||||
|
||||
- Une fois que la date de péremption est passée, la qualité se dégrade deux fois plus rapidement.
|
||||
- La qualité (`quality`) d'un produit ne peut jamais être négative.
|
||||
- "Aged Brie" augmente sa qualité (`quality`) plus le temps passe.
|
||||
- La qualité d'un produit n'est jamais de plus de 50.
|
||||
- "Sulfuras", étant un objet légendaire, n'a pas de date de péremption et ne perd jamais en qualité (`quality`)
|
||||
- "Backstage passes", comme le "Aged Brie", augmente sa qualité (`quality`) plus le temps passe (`sellIn`) ; La qualité augmente de 2 quand il reste 10 jours ou moins et de 3 quand il reste 5 jours ou moins, mais la qualité tombe à 0 après le concert.
|
||||
|
||||
Nous avons récemment signé un partenariat avec un fournisseur de produit invoqué ("Conjured").
|
||||
Cela nécessite une mise à jour de notre système :
|
||||
|
||||
- les éléments "Conjured" voient leur qualité se dégrader de deux fois plus vite que les objets normaux.
|
||||
|
||||
Vous pouvez faire les changements que vous voulez à la méthode `updateQuality` et ajouter autant de code que vous voulez, tant que tout fonctionne correctement.
|
||||
Cependant, nous devons vous prévenir, vous ne devez en aucun cas modifier la classe `Item` ou ses propriétés car cette classe appartient au gobelin à l'étage qui entrerait dans une rage instantanée et vous tuerait sans délai : il ne croit pas au partage du code.
|
||||
(Vous pouvez ajouter une méthode `updateQuality` et des propriétés statiques dans la classe `Item` si vous voulez, nous vous couvrirons)
|
||||
|
||||
Juste une précision, un produit ne peut jamais voir sa qualité augmenter au-dessus de 50, cependant "Sulfuras" est un objet légendaire et comme tel sa qualité est de 80 et elle ne change jamais.
|
||||
79
TypeScript/src/gilded-rose.ts
Normal file
79
TypeScript/src/gilded-rose.ts
Normal file
@ -0,0 +1,79 @@
|
||||
export class Item {
|
||||
name: string
|
||||
sellIn: number
|
||||
quality: number
|
||||
|
||||
constructor(name, sellIn, quality) {
|
||||
this.name = name
|
||||
this.sellIn = sellIn
|
||||
this.quality = quality
|
||||
}
|
||||
|
||||
static normalMaxQuality = 50
|
||||
static legendaryQuality = 80
|
||||
}
|
||||
|
||||
export class GildedRose {
|
||||
items: Array<Item>
|
||||
|
||||
constructor(items = [] as Array<Item>) {
|
||||
this.items = items
|
||||
}
|
||||
|
||||
updateQuality() {
|
||||
this.items.forEach(item => {
|
||||
const currentProductName = item.name
|
||||
// PART 1
|
||||
if (
|
||||
currentProductName != 'Aged Brie' &&
|
||||
currentProductName != 'Backstage passes to a TAFKAL80ETC concert'
|
||||
) {
|
||||
if (item.quality > 0) {
|
||||
if (currentProductName != 'Sulfuras, Hand of Ragnaros') {
|
||||
item.quality = item.quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (item.quality < 50) {
|
||||
item.quality = item.quality + 1
|
||||
if (currentProductName == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (item.sellIn < 11) {
|
||||
if (item.quality < 50) {
|
||||
item.quality = item.quality + 1
|
||||
}
|
||||
}
|
||||
if (item.sellIn < 6) {
|
||||
if (item.quality < 50) {
|
||||
item.quality = item.quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// part 2
|
||||
if (currentProductName != 'Sulfuras, Hand of Ragnaros') {
|
||||
item.sellIn = item.sellIn - 1
|
||||
}
|
||||
// part 3
|
||||
if (item.sellIn < 0) {
|
||||
if (currentProductName != 'Aged Brie') {
|
||||
if (currentProductName != 'Backstage passes to a TAFKAL80ETC concert') {
|
||||
if (item.quality > 0) {
|
||||
if (currentProductName != 'Sulfuras, Hand of Ragnaros') {
|
||||
item.quality = item.quality - 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.quality = item.quality - item.quality
|
||||
}
|
||||
} else {
|
||||
if (item.quality < 50) {
|
||||
item.quality = item.quality + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return this.items
|
||||
}
|
||||
}
|
||||
307
TypeScript/src/test/__snapshots__/gilded-rose.test.ts.snap
Normal file
307
TypeScript/src/test/__snapshots__/gilded-rose.test.ts.snap
Normal file
@ -0,0 +1,307 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 1`] = `"Day 1 - name: +5 Dexterity Vest quality: 20 sellIn: 10"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 2`] = `"Day 1 - name: Aged Brie quality: 1 sellIn: 1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 3`] = `"Day 1 - name: Elixir of the Mongoose quality: 5 sellIn: 3"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 4`] = `"Day 1 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 5`] = `"Day 1 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 6`] = `"Day 1 - name: Backstage passes to a TAFKAL80ETC concert quality: 25 sellIn: 10"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 7`] = `"Day 1 - name: Backstage passes to a TAFKAL80ETC concert quality: 50 sellIn: 4"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 8`] = `"Day 1 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -2"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 9`] = `"Day 1 - name: Conjured Mana Cake quality: 0 sellIn: -5"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 10`] = `"Day 2 - name: +5 Dexterity Vest quality: 11 sellIn: 1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 11`] = `"Day 2 - name: Aged Brie quality: 18 sellIn: -8"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 12`] = `"Day 2 - name: Elixir of the Mongoose quality: 0 sellIn: -6"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 13`] = `"Day 2 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 14`] = `"Day 2 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 15`] = `"Day 2 - name: Backstage passes to a TAFKAL80ETC concert quality: 47 sellIn: 1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 16`] = `"Day 2 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -5"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 17`] = `"Day 2 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -11"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 2 days 18`] = `"Day 2 - name: Conjured Mana Cake quality: 0 sellIn: -14"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 1`] = `"Day 1 - name: +5 Dexterity Vest quality: 0 sellIn: -8"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 2`] = `"Day 1 - name: Aged Brie quality: 36 sellIn: -17"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 3`] = `"Day 1 - name: Elixir of the Mongoose quality: 0 sellIn: -15"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 4`] = `"Day 1 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 5`] = `"Day 1 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 6`] = `"Day 1 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -8"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 7`] = `"Day 1 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -14"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 8`] = `"Day 1 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -20"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 9`] = `"Day 1 - name: Conjured Mana Cake quality: 0 sellIn: -23"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 10`] = `"Day 2 - name: +5 Dexterity Vest quality: 0 sellIn: -17"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 11`] = `"Day 2 - name: Aged Brie quality: 50 sellIn: -26"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 12`] = `"Day 2 - name: Elixir of the Mongoose quality: 0 sellIn: -24"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 13`] = `"Day 2 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 14`] = `"Day 2 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 15`] = `"Day 2 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -17"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 16`] = `"Day 2 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -23"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 17`] = `"Day 2 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -29"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 18`] = `"Day 2 - name: Conjured Mana Cake quality: 0 sellIn: -32"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 19`] = `"Day 3 - name: +5 Dexterity Vest quality: 0 sellIn: -26"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 20`] = `"Day 3 - name: Aged Brie quality: 50 sellIn: -35"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 21`] = `"Day 3 - name: Elixir of the Mongoose quality: 0 sellIn: -33"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 22`] = `"Day 3 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 23`] = `"Day 3 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 24`] = `"Day 3 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -26"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 25`] = `"Day 3 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -32"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 26`] = `"Day 3 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -38"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 27`] = `"Day 3 - name: Conjured Mana Cake quality: 0 sellIn: -41"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 28`] = `"Day 4 - name: +5 Dexterity Vest quality: 0 sellIn: -35"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 29`] = `"Day 4 - name: Aged Brie quality: 50 sellIn: -44"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 30`] = `"Day 4 - name: Elixir of the Mongoose quality: 0 sellIn: -42"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 31`] = `"Day 4 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 32`] = `"Day 4 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 33`] = `"Day 4 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -35"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 34`] = `"Day 4 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -41"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 35`] = `"Day 4 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -47"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 36`] = `"Day 4 - name: Conjured Mana Cake quality: 0 sellIn: -50"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 37`] = `"Day 5 - name: +5 Dexterity Vest quality: 0 sellIn: -44"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 38`] = `"Day 5 - name: Aged Brie quality: 50 sellIn: -53"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 39`] = `"Day 5 - name: Elixir of the Mongoose quality: 0 sellIn: -51"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 40`] = `"Day 5 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 41`] = `"Day 5 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 42`] = `"Day 5 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -44"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 43`] = `"Day 5 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -50"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 44`] = `"Day 5 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -56"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 45`] = `"Day 5 - name: Conjured Mana Cake quality: 0 sellIn: -59"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 46`] = `"Day 6 - name: +5 Dexterity Vest quality: 0 sellIn: -53"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 47`] = `"Day 6 - name: Aged Brie quality: 50 sellIn: -62"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 48`] = `"Day 6 - name: Elixir of the Mongoose quality: 0 sellIn: -60"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 49`] = `"Day 6 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 50`] = `"Day 6 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 51`] = `"Day 6 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -53"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 52`] = `"Day 6 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -59"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 53`] = `"Day 6 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -65"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 54`] = `"Day 6 - name: Conjured Mana Cake quality: 0 sellIn: -68"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 55`] = `"Day 7 - name: +5 Dexterity Vest quality: 0 sellIn: -62"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 56`] = `"Day 7 - name: Aged Brie quality: 50 sellIn: -71"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 57`] = `"Day 7 - name: Elixir of the Mongoose quality: 0 sellIn: -69"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 58`] = `"Day 7 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 59`] = `"Day 7 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 60`] = `"Day 7 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -62"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 61`] = `"Day 7 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -68"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 62`] = `"Day 7 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -74"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 63`] = `"Day 7 - name: Conjured Mana Cake quality: 0 sellIn: -77"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 64`] = `"Day 8 - name: +5 Dexterity Vest quality: 0 sellIn: -71"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 65`] = `"Day 8 - name: Aged Brie quality: 50 sellIn: -80"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 66`] = `"Day 8 - name: Elixir of the Mongoose quality: 0 sellIn: -78"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 67`] = `"Day 8 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 68`] = `"Day 8 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 69`] = `"Day 8 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -71"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 70`] = `"Day 8 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -77"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 71`] = `"Day 8 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -83"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 72`] = `"Day 8 - name: Conjured Mana Cake quality: 0 sellIn: -86"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 73`] = `"Day 9 - name: +5 Dexterity Vest quality: 0 sellIn: -80"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 74`] = `"Day 9 - name: Aged Brie quality: 50 sellIn: -89"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 75`] = `"Day 9 - name: Elixir of the Mongoose quality: 0 sellIn: -87"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 76`] = `"Day 9 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 77`] = `"Day 9 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 78`] = `"Day 9 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -80"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 79`] = `"Day 9 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -86"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 80`] = `"Day 9 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -92"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 81`] = `"Day 9 - name: Conjured Mana Cake quality: 0 sellIn: -95"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 82`] = `"Day 10 - name: +5 Dexterity Vest quality: 0 sellIn: -89"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 83`] = `"Day 10 - name: Aged Brie quality: 50 sellIn: -98"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 84`] = `"Day 10 - name: Elixir of the Mongoose quality: 0 sellIn: -96"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 85`] = `"Day 10 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 86`] = `"Day 10 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 87`] = `"Day 10 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -89"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 88`] = `"Day 10 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -95"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 89`] = `"Day 10 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -101"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 90`] = `"Day 10 - name: Conjured Mana Cake quality: 0 sellIn: -104"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 91`] = `"Day 11 - name: +5 Dexterity Vest quality: 0 sellIn: -98"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 92`] = `"Day 11 - name: Aged Brie quality: 50 sellIn: -107"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 93`] = `"Day 11 - name: Elixir of the Mongoose quality: 0 sellIn: -105"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 94`] = `"Day 11 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 95`] = `"Day 11 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 96`] = `"Day 11 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -98"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 97`] = `"Day 11 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -104"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 98`] = `"Day 11 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -110"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 99`] = `"Day 11 - name: Conjured Mana Cake quality: 0 sellIn: -113"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 100`] = `"Day 12 - name: +5 Dexterity Vest quality: 0 sellIn: -107"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 101`] = `"Day 12 - name: Aged Brie quality: 50 sellIn: -116"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 102`] = `"Day 12 - name: Elixir of the Mongoose quality: 0 sellIn: -114"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 103`] = `"Day 12 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 104`] = `"Day 12 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 105`] = `"Day 12 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -107"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 106`] = `"Day 12 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -113"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 107`] = `"Day 12 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -119"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 108`] = `"Day 12 - name: Conjured Mana Cake quality: 0 sellIn: -122"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 109`] = `"Day 13 - name: +5 Dexterity Vest quality: 0 sellIn: -116"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 110`] = `"Day 13 - name: Aged Brie quality: 50 sellIn: -125"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 111`] = `"Day 13 - name: Elixir of the Mongoose quality: 0 sellIn: -123"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 112`] = `"Day 13 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 113`] = `"Day 13 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 114`] = `"Day 13 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -116"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 115`] = `"Day 13 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -122"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 116`] = `"Day 13 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -128"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 117`] = `"Day 13 - name: Conjured Mana Cake quality: 0 sellIn: -131"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 118`] = `"Day 14 - name: +5 Dexterity Vest quality: 0 sellIn: -125"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 119`] = `"Day 14 - name: Aged Brie quality: 50 sellIn: -134"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 120`] = `"Day 14 - name: Elixir of the Mongoose quality: 0 sellIn: -132"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 121`] = `"Day 14 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 122`] = `"Day 14 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 123`] = `"Day 14 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -125"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 124`] = `"Day 14 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -131"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 125`] = `"Day 14 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -137"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 126`] = `"Day 14 - name: Conjured Mana Cake quality: 0 sellIn: -140"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 127`] = `"Day 15 - name: +5 Dexterity Vest quality: 0 sellIn: -134"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 128`] = `"Day 15 - name: Aged Brie quality: 50 sellIn: -143"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 129`] = `"Day 15 - name: Elixir of the Mongoose quality: 0 sellIn: -141"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 130`] = `"Day 15 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: 0"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 131`] = `"Day 15 - name: Sulfuras, Hand of Ragnaros quality: 80 sellIn: -1"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 132`] = `"Day 15 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -134"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 133`] = `"Day 15 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -140"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 134`] = `"Day 15 - name: Backstage passes to a TAFKAL80ETC concert quality: 0 sellIn: -146"`;
|
||||
|
||||
exports[`Gilded Rose should keep previous behavior for period of 15 days 135`] = `"Day 15 - name: Conjured Mana Cake quality: 0 sellIn: -149"`;
|
||||
43
TypeScript/src/test/gilded-rose.test.ts
Normal file
43
TypeScript/src/test/gilded-rose.test.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { Item, GildedRose } from '../gilded-rose'
|
||||
import { itemsGoldenMaster } from './golden-master-text-test'
|
||||
|
||||
describe('Gilded Rose', function () {
|
||||
it('should foo', function () {
|
||||
const gildedRose = new GildedRose([new Item('foo', 0, 0)])
|
||||
const items = gildedRose.updateQuality()
|
||||
expect(items[0].name).toMatchInlineSnapshot(`"foo"`)
|
||||
expect(items[0].quality).toMatchInlineSnapshot(`0`)
|
||||
expect(items[0].sellIn).toMatchInlineSnapshot(`-1`)
|
||||
})
|
||||
|
||||
describe('should keep previous behavior', () => {
|
||||
it('for period of 2 days', function () {
|
||||
const gildedRose = new GildedRose(itemsGoldenMaster)
|
||||
const days = 2
|
||||
for (let i = 0; i < days; i++) {
|
||||
itemsGoldenMaster.forEach(element => {
|
||||
expect(
|
||||
`Day ${i + 1} - name: ${element.name} quality: ${element.quality} sellIn: ${
|
||||
element.sellIn
|
||||
}`,
|
||||
).toMatchSnapshot()
|
||||
gildedRose.updateQuality()
|
||||
})
|
||||
}
|
||||
})
|
||||
it('for period of 15 days', function () {
|
||||
const gildedRose = new GildedRose(itemsGoldenMaster)
|
||||
const days = 15
|
||||
for (let i = 0; i < days; i++) {
|
||||
itemsGoldenMaster.forEach(element => {
|
||||
expect(
|
||||
`Day ${i + 1} - name: ${element.name} quality: ${element.quality} sellIn: ${
|
||||
element.sellIn
|
||||
}`,
|
||||
).toMatchSnapshot()
|
||||
gildedRose.updateQuality()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
25
TypeScript/src/test/golden-master-text-test.ts
Normal file
25
TypeScript/src/test/golden-master-text-test.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { Item, GildedRose } from '../gilded-rose'
|
||||
|
||||
export const itemsGoldenMaster = [
|
||||
new Item('+5 Dexterity Vest', 10, 20), //
|
||||
new Item('Aged Brie', 2, 0), //
|
||||
new Item('Elixir of the Mongoose', 5, 7), //
|
||||
new Item('Sulfuras, Hand of Ragnaros', 0, 80), //
|
||||
new Item('Sulfuras, Hand of Ragnaros', -1, 80),
|
||||
new Item('Backstage passes to a TAFKAL80ETC concert', 15, 20),
|
||||
new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
|
||||
new Item('Backstage passes to a TAFKAL80ETC concert', 5, 49),
|
||||
// this conjured item does not work properly yet
|
||||
new Item('Conjured Mana Cake', 3, 6),
|
||||
]
|
||||
|
||||
export const gildedRose = new GildedRose(itemsGoldenMaster)
|
||||
const days = 2
|
||||
for (let i = 0; i < days; i++) {
|
||||
console.log('-------- day ' + i + ' --------')
|
||||
console.log('name, sellIn, quality')
|
||||
itemsGoldenMaster.forEach(element => {
|
||||
console.log(element.name + ' ' + element.sellIn + ' ' + element.quality)
|
||||
})
|
||||
console.log()
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
import { expect } from 'chai';
|
||||
import { Item, GildedRose } from '../app/gilded-rose';
|
||||
|
||||
describe('Gilded Rose', function () {
|
||||
|
||||
it('should foo', function() {
|
||||
const gildedRose = new GildedRose([ new Item('foo', 0, 0) ]);
|
||||
const items = gildedRose.updateQuality();
|
||||
expect(items[0].name).to.equal('fixme');
|
||||
});
|
||||
|
||||
});
|
||||
@ -1,27 +0,0 @@
|
||||
import { Item, GildedRose } from '../app/gilded-rose';
|
||||
|
||||
const items = [
|
||||
new Item("+5 Dexterity Vest", 10, 20), //
|
||||
new Item("Aged Brie", 2, 0), //
|
||||
new Item("Elixir of the Mongoose", 5, 7), //
|
||||
new Item("Sulfuras, Hand of Ragnaros", 0, 80), //
|
||||
new Item("Sulfuras, Hand of Ragnaros", -1, 80),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
|
||||
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
|
||||
// this conjured item does not work properly yet
|
||||
new Item("Conjured Mana Cake", 3, 6)];
|
||||
|
||||
|
||||
const gildedRose = new GildedRose(items);
|
||||
var days: number = 2;
|
||||
for (let i = 0; i < days; i++) {
|
||||
console.log("-------- day " + i + " --------");
|
||||
console.log("name, sellIn, quality");
|
||||
items.forEach(element => {
|
||||
console.log(element.name + ' ' + element.sellIn + ' ' + element.quality);
|
||||
|
||||
});
|
||||
console.log();
|
||||
gildedRose.updateQuality();
|
||||
}
|
||||
@ -1,12 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"strict": true,
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules/*"],
|
||||
"compilerOptions": {
|
||||
"types": ["jest", "node"],
|
||||
"outDir": "./build/",
|
||||
"noImplicitAny": true,
|
||||
"module": "es6",
|
||||
"target": "es5",
|
||||
"jsx": "react",
|
||||
"allowJs": true,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": false
|
||||
}
|
||||
}
|
||||
|
||||
21
TypeScript/webpack.config.ts
Normal file
21
TypeScript/webpack.config.ts
Normal file
@ -0,0 +1,21 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
entry: "./src/index.ts",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: "ts-loader",
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts"],
|
||||
},
|
||||
output: {
|
||||
filename: "output.js",
|
||||
path: path.resolve(__dirname, "build"),
|
||||
},
|
||||
};
|
||||
3875
TypeScript/yarn.lock
Normal file
3875
TypeScript/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user