From 9abbf056d68f1d2cd8e0890a2b83538f01a9e071 Mon Sep 17 00:00:00 2001 From: James Hall Date: Wed, 4 Jan 2023 20:53:51 -0600 Subject: [PATCH] additional tests for first iteration --- js-jest/test/gilded_rose.test.js | 43 +++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/js-jest/test/gilded_rose.test.js b/js-jest/test/gilded_rose.test.js index 6e20cc36..f7bfa141 100644 --- a/js-jest/test/gilded_rose.test.js +++ b/js-jest/test/gilded_rose.test.js @@ -4,16 +4,16 @@ const gildedRose = new Shop([ new Item("Aged Brie", 2, 0), new Item("Sulfuras, Hand of Ragnaros", 0, 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), + 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), + new Item("Conjured Mana Cake", 3, 6), ]); describe("Initial state", function () { - it("number of items should equal 4", function () { - expect(gildedRose.items.length).toBe(4); + it("number of items should equal 8", function () { + expect(gildedRose.items.length).toBe(8); }); }); @@ -44,19 +44,38 @@ describe("After one updateQuality call", function() { expect(items[2].quality).toBe(80); }); - it("Backstage passes should have decremented sellIn by 1", function () { + it("First backstage pass should have decremented sellIn by 1", function () { expect(items[3].sellIn).toBe(14); }); - it("Backstage passes should have incremented quality by 1", function () { + it("First backstage pass should have incremented quality by 1", function () { expect(items[3].quality).toBe(21); }); - // it("should foo", function() { - // const items = gildedRose.updateQuality(); - // expect(items[0].name).toBe("fixme"); - // }); + it("Second backstage pass should have decremented sellIn by 1", function () { + expect(items[4].sellIn).toBe(9); + }); + + it("Second backstage pass should have incremented quality by 2", function () { + expect(items[4].quality).toBe(51); + }); + + it("Third backstage pass should have decremented sellIn by 1", function () { + expect(items[5].sellIn).toBe(4); + }); + + it("Third backstage pass should have incremented quality by 3", function () { + expect(items[5].quality).toBe(52); + }); + + it("Conjured item should have decremented sellIn by 1", function () { + expect(items[5].sellIn).toBe(2); + }); + + it("Conjured item pass should have decremented quality by 2", function () { + expect(items[5].quality).toBe(4); + }); + }); -