From 1fb84b5bb2be572d686fe060b3da9343ea00485d Mon Sep 17 00:00:00 2001 From: Dan Holmes Date: Thu, 3 Dec 2020 14:02:20 +0000 Subject: [PATCH] Add tests for backstage passes --- js-jasmine/spec/shop_spec.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/js-jasmine/spec/shop_spec.js b/js-jasmine/spec/shop_spec.js index f1936d31..8fec1b9f 100644 --- a/js-jasmine/spec/shop_spec.js +++ b/js-jasmine/spec/shop_spec.js @@ -59,5 +59,33 @@ describe('Shop', () => { expect(items[0].sellIn).toEqual(5); expect(items[0].quality).toEqual(5); }); + it('will increase the quality of backstage passes by 1, more than 10 days before the concert', () => { + item.name = 'Backstage passes to a TAFKAL80ETC concert'; + item.sellIn = 11; + item.quality = 5; + const items = gildedRose.updateQuality(); + expect(items[0].quality).toEqual(6); + }); + it('will increase the quality of backstage passes by 2, 10 - 6 days before the concert', () => { + item.name = 'Backstage passes to a TAFKAL80ETC concert'; + item.sellIn = 8; + item.quality = 5; + const items = gildedRose.updateQuality(); + expect(items[0].quality).toEqual(7); + }); + it('will increase the quality of backstage passes by 3, 5 or less days before the concert', () => { + item.name = 'Backstage passes to a TAFKAL80ETC concert'; + item.sellIn = 5; + item.quality = 5; + const items = gildedRose.updateQuality(); + expect(items[0].quality).toEqual(8); + }); + it('will decrease the quality of backstage passes to 0 after concert.', () => { + item.name = 'Backstage passes to a TAFKAL80ETC concert'; + item.sellIn = 0; + item.quality = 5; + const items = gildedRose.updateQuality(); + expect(items[0].quality).toEqual(0); + }); }); });