From 5751a8a656757795f495ab1c72ac2c6b794d17b8 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 5 May 2018 20:29:39 -0400 Subject: [PATCH] Adding unit tests --- tests/billing.test.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/billing.test.js diff --git a/tests/billing.test.js b/tests/billing.test.js new file mode 100644 index 0000000..26d9740 --- /dev/null +++ b/tests/billing.test.js @@ -0,0 +1,28 @@ +import { calculateCost } from "../libs/billing-lib"; + +test("Lowest tier", () => { + const storage = 10; + + const cost = 4000; + const expectedCost = calculateCost(storage); + + expect(cost).toEqual(expectedCost); +}); + +test("Middle tier", () => { + const storage = 100; + + const cost = 20000; + const expectedCost = calculateCost(storage); + + expect(cost).toEqual(expectedCost); +}); + +test("Highest tier", () => { + const storage = 101; + + const cost = 10100; + const expectedCost = calculateCost(storage); + + expect(cost).toEqual(expectedCost); +});