Skip to content

Commit 7db9933

Browse files
committed
Section 32: Test Driven Development pt1
1 parent 0764a14 commit 7db9933

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
forEach(arr, fn) {
3+
for (let index in arr) {
4+
fn(arr[index], index)
5+
}
6+
},
7+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { forEach, map } = require('./index')
2+
3+
let sum = 0
4+
forEach([1, 2, 3], (value) => {
5+
sum += value
6+
})
7+
8+
console.log(sum)
9+
10+
if(sum !== 6) {
11+
throw new Error('Expected summing array to equal 6')
12+
}

32-The-Basics-of-Testing/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,22 @@
22

33
**folder 01**
44

5-
## 1. 01 Testing Overview
5+
## 1. 01 Testing Overview
6+
7+
### Goals of Testing
8+
9+
- Automate the process of ensuring that our app works as we expect
10+
- Keep us from having to manually click around the app to find bugs
11+
- Make sure the app still works as expected even after twe change something
12+
13+
### Personal Thoughts
14+
15+
- People spend more time setting up testing than they do writing tests
16+
- All testing frameworks / libraries are essentially the same
17+
- You don't even have to use a testing library
18+
19+
## 2. 02 A Simple Function to Test
20+
21+
## 3. 03 A No-Frills Testing Implementation
22+
23+
## 4. 04 Test Driven Development

0 commit comments

Comments
 (0)