Skip to content

Commit ef8288d

Browse files
committed
Make sure script.js runs after tests have been ran
1 parent a23fc54 commit ef8288d

File tree

2 files changed

+50
-46
lines changed

2 files changed

+50
-46
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
<script src="script.js" type="text/javascript"></script>
1919
<script>mocha.setup('bdd');</script>
2020
<script src="test/test-script.js"type="text/javascript"></script>
21-
<script>mocha.run();</script>
21+
<script>mocha.run(runAfterTests);</script>
2222
</body>
2323
</html>

script.js

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
1-
/**
2-
* Follow the comments below.
3-
* Feel free to use `console.log` to see what values are being returned.
4-
5-
// Create a variable called `myNumber`, and assign it to any number
6-
7-
/**
8-
* Create another variable called `stringValue`.
9-
* Assign it the value that's returned when you pass
10-
* `myNumber into the function `numberToString`.
11-
*/
12-
13-
/**
14-
* If you pass `myNumber` and `stringValue` into `areEqual`,
15-
* what value will you get back? Why is that?
16-
*/
17-
18-
/**
19-
* You may have noticed that the `calculate` function combined
20-
* the functionality of `add`, `subtract`, `multiply`, and `divide`.
21-
* Did you try to use those functions _inside_ of `calculate`?
22-
* If you didn't go back and try it, this is called "reusability"!
23-
*/
24-
25-
// Do you see any other functions where code could be reused?
26-
27-
/**
28-
* For your `letterGrade` function,
29-
* what happens if you provide a `score` that is less than 0,
30-
* or greater than the `total` value?
31-
* Does it still work as expected? If it doesn't, how could you improve this?
32-
*/
33-
34-
/**
35-
* Your `combine` function looks okay,
36-
* but what if you wanted to join it with ANY string instead of a single space?
37-
* Create a new function called `improvedCombine`,
38-
* with the same parameters as `combine`, but also add a
39-
* third parameter called `glue` (a string value).
40-
*/
41-
42-
// What happens if you were to uncomment the following lines?
43-
44-
// combine = improvedCombine;
45-
// console.log(combine('combine', 'improved!', ' is '));
1+
// Please make sure all your code is added inside the `runAfterTests` function.
2+
function runAfterTests() {
3+
/**
4+
* Follow the comments below.
5+
* Feel free to use `console.log` to see what values are being returned.
6+
*/
7+
8+
// Create a variable called `myNumber`, and assign it to any number
9+
10+
/**
11+
* Create another variable called `stringValue`.
12+
* Assign it the value that's returned when you pass
13+
* `myNumber into the function `numberToString`.
14+
*/
15+
16+
/**
17+
* If you pass `myNumber` and `stringValue` into `areEqual`,
18+
* what value will you get back? Why is that?
19+
*/
20+
21+
/**
22+
* You may have noticed that the `calculate` function combined
23+
* the functionality of `add`, `subtract`, `multiply`, and `divide`.
24+
* Did you try to use those functions _inside_ of `calculate`?
25+
* If you didn't go back and try it, this is called "reusability"!
26+
*/
27+
28+
// Do you see any other functions where code could be reused?
29+
30+
/**
31+
* For your `letterGrade` function,
32+
* what happens if you provide a `score` that is less than 0,
33+
* or greater than the `total` value?
34+
* Does it still work as expected? If it doesn't, how could you improve this?
35+
*/
36+
37+
/**
38+
* Your `combine` function looks okay,
39+
* but what if you wanted to join it with ANY string instead of a single space?
40+
* Create a new function called `improvedCombine`,
41+
* with the same parameters as `combine`, but also add a
42+
* third parameter called `glue` (a string value).
43+
*/
44+
45+
// What happens if you were to uncomment the following lines?
46+
47+
// combine = improvedCombine;
48+
// console.log(combine('combine', 'improved!', ' is '));
49+
}

0 commit comments

Comments
 (0)