Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Commit de392da

Browse files
committed
Add test instructions
1 parent f128c69 commit de392da

File tree

8 files changed

+75
-18
lines changed

8 files changed

+75
-18
lines changed

2-mandatory/1-create-functions.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ Write a function that:
33
- Accepts an array as a parameter.
44
- Returns a new array containing the first five elements of the passed array.
55
*/
6-
function first5() {
7-
}
6+
function first5() {}
87

98
/*
109
Write a function that:
1110
- Accepts an array as a parameter.
1211
- Returns a new array containing the same elements, except sorted.
1312
*/
14-
function sortArray() {
15-
}
13+
function sortArray() {}
1614

1715
/*
1816
NOTE: This exercise is the same as one you did last week - try to do it again using things you learnt this week.
@@ -24,17 +22,15 @@ Write a function that:
2422
- Removes any forward slashes (/) in the strings.
2523
- Makes the strings all lowercase.
2624
*/
27-
function tidyUpString() {
28-
}
25+
function tidyUpString() {}
2926

3027
/*
3128
Write a function that:
3229
- Takes an array and an index as input.
3330
- Returns a new array containing the same elements, but without the element at the passed index.
3431
*/
3532

36-
function remove() {
37-
}
33+
function remove() {}
3834

3935
/*
4036
Write a function that:
@@ -44,10 +40,16 @@ Write a function that:
4440
- Numbers greater 100 must be replaced with 100.
4541
*/
4642

47-
function formatPercentage() {
48-
}
43+
function formatPercentage() {}
4944

50-
/* ======= TESTS - DO NOT MODIFY ===== */
45+
/*
46+
===================================================
47+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
48+
There are some Tests in this file that will help you work out if your code is working.
49+
To run the tests for just this one file, type `npm test -- --testPathPattern 1-create-functions` into your terminal
50+
(Reminder: You must have run `npm install` one time before this will work!)
51+
===================================================
52+
*/
5153

5254
test("first5 function works for more than five elements", () => {
5355
const numbers = [1, 2, 3, 4, 5, 6, 7, 8];

2-mandatory/2-oxygen-levels.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313

1414
function findSafeOxygenLevel() {}
1515

16-
/* ======= TESTS - DO NOT MODIFY ===== */
16+
/*
17+
===================================================
18+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
19+
There are some Tests in this file that will help you work out if your code is working.
20+
To run the tests for just this one file, type `npm test -- --testPathPattern 2-oxygen-levels` into your terminal
21+
(Reminder: You must have run `npm install` one time before this will work!)
22+
===================================================
23+
*/
1724

1825
test("findSafeOxygenLevel function works - case 1", () => {
1926
expect(

2-mandatory/3-bush-berries.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ function isBushSafe(berryArray) {
2525
//Write your code here
2626
}
2727

28-
/* ======= TESTS - DO NOT MODIFY ===== */
28+
/*
29+
===================================================
30+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
31+
There are some Tests in this file that will help you work out if your code is working.
32+
To run the tests for just this one file, type `npm test -- --testPathPattern 3-bush-berries` into your terminal
33+
(Reminder: You must have run `npm install` one time before this will work!)
34+
===================================================
35+
*/
2936

3037
test("isBushSafe finds toxic bush", () => {
3138
expect(
@@ -38,3 +45,9 @@ test("isBushSafe function finds safe bush", () => {
3845
"Bush is safe to eat from"
3946
);
4047
});
48+
49+
test("isBushSafe finds toxic bush when all toxic", () => {
50+
expect(isBushSafe(["neon", "transparent", "red", "green", "grey"])).toEqual(
51+
"Toxic! Leave bush alone!"
52+
);
53+
});

2-mandatory/4-space-colonies.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717

1818
function getSettlers() {}
1919

20-
/* ======= TESTS - DO NOT MODIFY ===== */
20+
/*
21+
===================================================
22+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
23+
There are some Tests in this file that will help you work out if your code is working.
24+
To run the tests for just this one file, type `npm test -- --testPathPattern 4-space-colonies` into your terminal
25+
(Reminder: You must have run `npm install` one time before this will work!)
26+
===================================================
27+
*/
2128

2229
test("getSettlers function works", () => {
2330
const voyagers = [

2-mandatory/5-eligible-students.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99

1010
function getEligibleStudents() {}
1111

12-
/* ======= TESTS - DO NOT MODIFY ===== */
12+
/*
13+
===================================================
14+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
15+
There are some Tests in this file that will help you work out if your code is working.
16+
To run the tests for just this one file, type `npm test -- --testPathPattern 5-eligible-students` into your terminal
17+
(Reminder: You must have run `npm install` one time before this will work!)
18+
===================================================
19+
*/
1320

1421
test("getEligibleStudents function works", () => {
1522
const attendance = [

2-mandatory/6-journey-planner.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,14 @@ function journeyPlanner(locations, transportMode) {
125125
// Implement the function body
126126
}
127127

128-
/* ======= TESTS - DO NOT MODIFY ===== */
128+
/*
129+
===================================================
130+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
131+
There are some Tests in this file that will help you work out if your code is working.
132+
To run the tests for just this one file, type `npm test -- --testPathPattern 6-journey-planner` into your terminal
133+
(Reminder: You must have run `npm install` one time before this will work!)
134+
===================================================
135+
*/
129136

130137
const string1 = "I Love coding and perfect code makes me happy";
131138
const string2 = "I don't like to do coding";

2-mandatory/7-lane-names.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88

99
function getLanes() {}
1010

11-
/* ======= TESTS - DO NOT MODIFY ===== */
11+
/*
12+
===================================================
13+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
14+
There are some Tests in this file that will help you work out if your code is working.
15+
To run the tests for just this one file, type `npm test -- --testPathPattern 7-lane-names` into your terminal
16+
(Reminder: You must have run `npm install` one time before this will work!)
17+
===================================================
18+
*/
1219

1320
test("getLanes function works", () => {
1421
const streetNames = [

2-mandatory/8-password-validator.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ function containsSymbol(string) {
4545
return /[!#$%.*&]/.test(string);
4646
}
4747

48-
/* ======= TESTS - DO NOT MODIFY ===== */
48+
/*
49+
===================================================
50+
======= TESTS - DO NOT MODIFY BELOW THIS LINE =====
51+
There are some Tests in this file that will help you work out if your code is working.
52+
To run the tests for just this one file, type `npm test -- --testPathPattern 8-password-validator` into your terminal
53+
(Reminder: You must have run `npm install` one time before this will work!)
54+
===================================================
55+
*/
4956

5057
test("Example 1", () => {
5158
expect(

0 commit comments

Comments
 (0)