Skip to content
This repository was archived by the owner on Oct 26, 2020. It is now read-only.

Commit c8e0ebb

Browse files
committed
Add test instructions
1 parent a40d094 commit c8e0ebb

File tree

7 files changed

+85
-38
lines changed

7 files changed

+85
-38
lines changed

week-1/2-mandatory/1-syntax-errors.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
// There are syntax errors in this code - can you fix it to pass the tests?
24

35
function addNumbers(a b c) {
@@ -15,6 +17,8 @@ function getAddition(a, b) {
1517
}
1618

1719
/* ======= TESTS - DO NOT MODIFY ===== */
20+
//
21+
// To run these tests type `node 1-syntax-errors.js` into your terminal
1822

1923
function test(test_name, expr) {
2024
let status;

week-1/2-mandatory/2-logic-error.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ function multiply(a, b, c) {
1313
return;
1414
}
1515

16-
/* ======= TESTS - DO NOT MODIFY ===== */
16+
/* ======= TESTS - DO NOT MODIFY =====
17+
There are some Tests in this file that will help you work out if your code is working.
18+
19+
To run these tests type `node 2-logic-error` into your terminal
20+
*/
1721

1822
function test(test_name, expr) {
1923
let status;
Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
// Add comments to explain what this function does. You're meant to use Google!
22
function getNumber() {
3-
return Math.random() * 10;
3+
return Math.random() * 10;
44
}
55

66
// Add comments to explain what this function does. You're meant to use Google!
77
function s(w1, w2) {
8-
return w1.concat(w2);
8+
return w1.concat(w2);
99
}
1010

1111
function concatenate(firstWord, secondWord, thirdWord) {
12-
// Write the body of this function to concatenate three words together
13-
// Look at the test case below to understand what to expect in return
12+
// Write the body of this function to concatenate three words together
13+
// Look at the test case below to understand what to expect in return
1414
}
1515

16-
/* ======= TESTS - DO NOT MODIFY ===== */
16+
/* ======= TESTS - DO NOT MODIFY =====
17+
There are some Tests in this file that will help you work out if your code is working.
18+
19+
To run these tests type `node 3-function-output` into your terminal
20+
*/
1721

1822
function test(test_name, expr) {
19-
let status;
20-
if (expr) {
21-
status = "PASSED"
22-
} else {
23-
status = "FAILED"
24-
}
25-
26-
console.log(`${test_name}: ${status}`)
23+
let status;
24+
if (expr) {
25+
status = "PASSED";
26+
} else {
27+
status = "FAILED";
28+
}
29+
30+
console.log(`${test_name}: ${status}`);
2731
}
28-
29-
test("concatenate function - case 1 works", concatenate('code', 'your', 'future') === "code your future")
30-
test("concatenate function - case 2 works", concatenate('I', 'like', 'pizza') === "I like pizza")
31-
test("concatenate function - case 3 works", concatenate('I', 'am', 13) === "I am 13")
32+
33+
test(
34+
"concatenate function - case 1 works",
35+
concatenate("code", "your", "future") === "code your future"
36+
);
37+
test(
38+
"concatenate function - case 2 works",
39+
concatenate("I", "like", "pizza") === "I like pizza"
40+
);
41+
test(
42+
"concatenate function - case 3 works",
43+
concatenate("I", "am", 13) === "I am 13"
44+
);

week-1/2-mandatory/4-tax.js

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,36 @@ function calculateSalesTax() {}
1919

2020
function formatCurrency() {}
2121

22-
/* ======= TESTS - DO NOT MODIFY ===== */
22+
/* ======= TESTS - DO NOT MODIFY =====
23+
There are some Tests in this file that will help you work out if your code is working.
24+
25+
To run these tests type `node 4-tax.js` into your terminal
26+
*/
2327

2428
function test(test_name, expr) {
2529
let status;
2630
if (expr) {
27-
status = "PASSED"
31+
status = "PASSED";
2832
} else {
29-
status = "FAILED"
33+
status = "FAILED";
3034
}
3135

32-
console.log(`${test_name}: ${status}`)
36+
console.log(`${test_name}: ${status}`);
3337
}
3438

35-
test("calculateSalesTax function - case 1 works", calculateSalesTax(15) === 18)
36-
test("calculateSalesTax function - case 2 works", calculateSalesTax(17.5) === 21)
37-
test("calculateSalesTax function - case 3 works", calculateSalesTax(34) === 40.8)
38-
39-
test("formatCurrency function - case 1 works", formatCurrency(15) === "£18.00")
40-
test("formatCurrency function - case 2 works", formatCurrency(17.5) === "£21.00")
41-
test("formatCurrency function - case 3 works", formatCurrency(34) === "£40.80")
39+
test("calculateSalesTax function - case 1 works", calculateSalesTax(15) === 18);
40+
test(
41+
"calculateSalesTax function - case 2 works",
42+
calculateSalesTax(17.5) === 21
43+
);
44+
test(
45+
"calculateSalesTax function - case 3 works",
46+
calculateSalesTax(34) === 40.8
47+
);
48+
49+
test("formatCurrency function - case 1 works", formatCurrency(15) === "£18.00");
50+
test(
51+
"formatCurrency function - case 2 works",
52+
formatCurrency(17.5) === "£21.00"
53+
);
54+
test("formatCurrency function - case 3 works", formatCurrency(34) === "£40.80");

week-1/3-extra/1-currency-conversion.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ function convertToUSD() {}
1818

1919
function convertToBRL() {}
2020

21-
/* ======= TESTS - DO NOT MODIFY ===== */
21+
/* ======= TESTS - DO NOT MODIFY =====
22+
There are some Tests in this file that will help you work out if your code is working.
23+
24+
To run these tests type `node 1-currency-conversion` into your terminal
25+
*/
2226

2327
function test(test_name, expr) {
2428
let status;
2529
if (expr) {
26-
status = "PASSED"
30+
status = "PASSED";
2731
} else {
28-
status = "FAILED"
32+
status = "FAILED";
2933
}
3034

31-
console.log(`${test_name}: ${status}`)
35+
console.log(`${test_name}: ${status}`);
3236
}
3337

34-
test('convertToUSD function works', convertToUSD(32) === 44.8)
35-
test('convertToBRL function works', convertToBRL(30) === 172.71)
38+
test("convertToUSD function works", convertToUSD(32) === 44.8);
39+
test("convertToBRL function works", convertToBRL(30) === 172.71);

week-1/3-extra/2-piping.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ let badCode =
3737

3838
let goodCode =
3939

40-
/* ======= TESTS - DO NOT MODIFY ===== */
40+
/* ======= TESTS - DO NOT MODIFY =====
41+
There are some Tests in this file that will help you work out if your code is working.
42+
43+
To run these tests type `node 2-piping.js` into your terminal
44+
*/
4145

4246
function test(test_name, expr) {
4347
let status;

week-1/3-extra/3-magic-8-ball.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ let answer;
5757
// - very negative
5858
function checkAnswer() {}
5959

60-
/* ======= TESTS - DO NOT MODIFY ===== */
60+
/* ======= TESTS - DO NOT MODIFY =====
61+
There are some Tests in this file that will help you work out if your code is working.
62+
63+
To run these tests type `node 3-magic-8-ball.js` into your terminal
64+
*/
65+
6166
const log = console.log;
6267
let logged;
63-
console.log = function() {
68+
console.log = function () {
6469
log(...arguments);
6570
logged = arguments[0];
6671
};

0 commit comments

Comments
 (0)