From 20b98dac0e3ea2ae53af1e20999d45f0022ad8ba Mon Sep 17 00:00:00 2001 From: Ben Hemann Date: Mon, 7 Jun 2021 12:47:05 -0500 Subject: [PATCH] finished testing for backstage passes --- TypeScript/test/gilded-rose.spec.ts | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/TypeScript/test/gilded-rose.spec.ts b/TypeScript/test/gilded-rose.spec.ts index f826bdad..6b42e57e 100644 --- a/TypeScript/test/gilded-rose.spec.ts +++ b/TypeScript/test/gilded-rose.spec.ts @@ -1,6 +1,8 @@ import { expect } from 'chai'; import { Item, GildedRose } from '../app/gilded-rose'; + +// General Tests to ensure it works for newly created item describe('Gilded Rose', function () { it('should foo', function() { @@ -29,6 +31,37 @@ describe('Gilded Rose', function () { }); }); +// tests to check if specific items work correctly + +describe('Backstage Pass', function () { + it('Backstage pass should increase in quality by 2 with only 10 days left', function () { + const gildedRose = new GildedRose ([ new Item('Backstage passes to a TAFKAL80ETC concert', 10, 5)]); + const items = gildedRose.updateQuality(); + expect(items[0].quality).to.equal(7); + }) +}) + +describe('Backstage Pass', function () { + it('Backstage pass should increase in quality by 3 with 5 days left', function () { + const gildedRose = new GildedRose ([ new Item('Backstage passes to a TAFKAL80ETC concert', 5, 5)]); + const items = gildedRose.updateQuality(); + expect(items[0].quality).to.equal(8); + }) +}) +describe('Backstage Pass', function () { + it('Backstage pass should increase in quality by 3, but quality is at 49', function () { + const gildedRose = new GildedRose ([ new Item('Backstage passes to a TAFKAL80ETC concert', 4, 49)]); + const items = gildedRose.updateQuality(); + expect(items[0].quality).to.equal(50); + }) +}) +describe('Backstage Pass', function () { + it('Backstage pass quality should drop to 0 after concert', function () { + const gildedRose = new GildedRose ([ new Item('Backstage passes to a TAFKAL80ETC concert', 0, 50)]); + const items = gildedRose.updateQuality(); + expect(items[0].quality).to.equal(0); + }) +}) \ No newline at end of file