mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Delete js-jasmine directory
This commit is contained in:
parent
a6a74e943c
commit
5c6ca00e07
1
js-jasmine/.gitignore
vendored
1
js-jasmine/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/node_modules/
|
||||
@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "gilded-rose-kata",
|
||||
"version": "1.0.0",
|
||||
"description": "Gilded Rose kata in Javascript with Jasmine",
|
||||
"scripts": {
|
||||
"test": "jasmine"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/emilybache/GildedRose-Refactoring-Kata.git"
|
||||
},
|
||||
"keywords": [
|
||||
"kata",
|
||||
"refactor",
|
||||
"gilded-rose"
|
||||
],
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"bugs": {
|
||||
"url": "https://github.com/emilybache/GildedRose-Refactoring-Kata/issues"
|
||||
},
|
||||
"homepage": "https://github.com/emilybache/GildedRose-Refactoring-Kata",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.0",
|
||||
"@babel/preset-env": "7.14.0",
|
||||
"@babel/register": "^7.13.0",
|
||||
"jasmine": "^3.7.0"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": []
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
var {Shop, Item} = require('../src/gilded_rose.js');
|
||||
describe("Gilded Rose", function() {
|
||||
|
||||
it("should foo", function() {
|
||||
const gildedRose = new Shop([ new Item("foo", 0, 0) ]);
|
||||
const items = gildedRose.updateQuality();
|
||||
expect(items[0].name).toEqual("fixme");
|
||||
});
|
||||
|
||||
});
|
||||
@ -1,11 +0,0 @@
|
||||
{
|
||||
"spec_dir": "spec",
|
||||
"spec_files": [
|
||||
"**/*[sS]pec.js"
|
||||
],
|
||||
"helpers": [
|
||||
"../node_modules/babel-register/lib/node.js"
|
||||
],
|
||||
"oneFailurePerSpec": false,
|
||||
"randomizeTests": true
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
|
||||
const { Shop, Item } = require("../src/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 days = Number(process.argv[2]) || 2;
|
||||
const gildedRose = new Shop(items);
|
||||
|
||||
console.log("OMGHAI!");
|
||||
for (let day = 0; day < days; day++) {
|
||||
console.log(`\n-------- day ${day} --------`);
|
||||
console.log("name, sellIn, quality");
|
||||
items.forEach(item => console.log(`${item.name}, ${item.sellIn}, ${item.quality}`));
|
||||
gildedRose.updateQuality();
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
class Item {
|
||||
constructor(name, sellIn, quality){
|
||||
this.name = name;
|
||||
this.sellIn = sellIn;
|
||||
this.quality = quality;
|
||||
}
|
||||
}
|
||||
|
||||
class Shop {
|
||||
constructor(items=[]){
|
||||
this.items = items;
|
||||
}
|
||||
updateQuality() {
|
||||
for (var 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;
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
Item,
|
||||
Shop
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user