From 16302987512a4c9b215866dc172ecb94b4fa16d8 Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Mon, 22 Jun 2020 21:48:47 +0100 Subject: [PATCH 1/2] Clarify that function should add tax --- week-1/2-mandatory/4-tax.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/week-1/2-mandatory/4-tax.js b/week-1/2-mandatory/4-tax.js index 93f21dd..79db540 100644 --- a/week-1/2-mandatory/4-tax.js +++ b/week-1/2-mandatory/4-tax.js @@ -12,12 +12,12 @@ function calculateSalesTax() {} =================== The business has informed you that prices must have 2 decimal places They must also start with the currency symbol - Write a function that transforms numbers into the format £0.00 + Write a function that adds tax to a number, and then transforms the total into the format £0.00 Remember that the prices must include the sales tax (hint: you already wrote a function for this!) */ -function formatCurrency() {} +function addTaxAndFormatCurrency() {} /* ======= TESTS - DO NOT MODIFY ===== There are some Tests in this file that will help you work out if your code is working. @@ -41,6 +41,6 @@ test("calculateSalesTax function - case 1 works", calculateSalesTax(15), 18) test("calculateSalesTax function - case 2 works", calculateSalesTax(17.5), 21) test("calculateSalesTax function - case 3 works", calculateSalesTax(34), 40.8) -test("formatCurrency function - case 1 works", formatCurrency(15), "£18.00") -test("formatCurrency function - case 2 works", formatCurrency(17.5), "£21.00") -test("formatCurrency function - case 3 works", formatCurrency(34), "£40.80") +test("addTaxAndFormatCurrency function - case 1 works", addTaxAndFormatCurrency(15), "£18.00") +test("addTaxAndFormatCurrency function - case 2 works", addTaxAndFormatCurrency(17.5), "£21.00") +test("addTaxAndFormatCurrency function - case 3 works", addTaxAndFormatCurrency(34), "£40.80") From 10901fd375a99f2a6609599b4a6b2285214636ac Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Mon, 22 Jun 2020 22:09:18 +0100 Subject: [PATCH 2/2] Add specific tests for checkAnswer --- week-1/3-extra/3-magic-8-ball.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/week-1/3-extra/3-magic-8-ball.js b/week-1/3-extra/3-magic-8-ball.js index ed2e8dd..edb75fe 100644 --- a/week-1/3-extra/3-magic-8-ball.js +++ b/week-1/3-extra/3-magic-8-ball.js @@ -90,6 +90,17 @@ function testAll() { logged === "The ball has shaken!" ); test(`shakeBall returns an string answer`, typeof answer === "string"); + + test( + `checkAnswer("It is decidedly so.") returns "very positive`, + checkAnswer("It is decidedly so.") === "very positive" + ) + + test( + `checkAnswer("My reply is no.") returns "very negative`, + checkAnswer("My reply is no.") === "very negative" + ) + test( `checkAnswer returns the level of positivity"`, ["very positive", "positive", "negative", "very negative"].includes(