Skip to content

Commit 2c67c4b

Browse files
authored
fix: correct typo in README regarding expected result (#32)
1 parent b7a1cd8 commit 2c67c4b

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

exercises/01.principles/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Conceptually, the steps we have to test the `sum` function remain the same:
5050

5151
1. Pick a code to test (i.e. our `sum` function);
5252
1. Run the code with particular arguments;
53-
1. Check whether the actual result equals to the expected (indended) result.
53+
1. Check whether the actual result equals to the expected (intended) result.
5454

5555
Here are the same steps (abstractly) represented in JavaScript:
5656

exercises/02.test-structure/01.problem.assertions/greet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ if (message !== 'Congrats, Sarah!') {
3434
// return { toBe(expected) {} }
3535

3636
// 🐨 In the "toBe" function, compare the "actual" and the "expected"
37-
// values, and throw an error if they don't mtach.
37+
// values, and throw an error if they don't match.
3838
// 💰 You can throw an error like this one:
3939
// new Error(`Expected ${actual} to equal to ${expected}`)

exercises/02.test-structure/03.problem.test-files/greet.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ function congratulate(name: string) {
1111
}
1212

1313
// 🐨 Move the existing tests for "greet()" and "congratulate()"
14-
// to the newly added "greet.test.js" file. Don't forget to
15-
// import the "test()" and "congratulate()" functions there!
14+
// to the newly added "greet.test.ts" file. Don't forget to
15+
// import the "greet()" and "congratulate()" functions there!
1616
test('returns a greeting message for the given name', () => {
1717
expect(greet('John')).toBe('Hello, John!')
1818
})
@@ -22,7 +22,7 @@ test('returns a congratulation message for the given name', () => {
2222
})
2323

2424
// 🐨 Move the existing "expect()" and "test()" functions to the
25-
// newly added "setup.js" file.
25+
// newly added "setup.ts" file.
2626
function expect(actual: unknown) {
2727
return {
2828
toBe(expected: unknown) {

exercises/02.test-structure/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Now that we have the basic test written, let's iterate on it. See, no matter wha
88
1. Compare the actual result with the expected result;
99
1. Throw an error if those two don't match.
1010

11-
In other words, every test follows 📜 [a predicatable structure](https://www.epicweb.dev/anatomy-of-a-test). And that's great! It means we can open any project and go to any test and follow that structure to help us navigate around and understand things. It also helps with writing tests because it gives us this framework on how to approach testing _anything_.
11+
In other words, every test follows 📜 [a predictable structure](https://www.epicweb.dev/anatomy-of-a-test). And that's great! It means we can open any project and go to any test and follow that structure to help us navigate around and understand things. It also helps with writing tests because it gives us this framework on how to approach testing _anything_.
1212

1313
---
1414

exercises/03.async/01.problem.await/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function greetByResponse(response: Response) {
1414
So now, whenever we need to greet a fetched user, we can use this new function:
1515

1616
```ts nocopy nonumber
17-
fecth('/api/user')
17+
fetch('/api/user')
1818
.then(response => greetByResponse(response))
1919
.then(greeting => render(greeting))
2020
```

exercises/03.async/03.problem.waitFor/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<EpicVideo url="https://www.epicweb.dev/workshops/testing-fundamentals/testing-asynchronous-code/testing-with-async-side-effects" />
44

5-
The asynchronous nature of some behaviors may be hidden from us. For example, when using React, we can update the state in response to a user request but the actual state transition cannot be accessed in test (e.g. to be awaited). It happens as a _side effect_. The thing is, we still have the intention we want to test coupled with that incaccessible side effect, so we need to account for it somehow.
5+
The asynchronous nature of some behaviors may be hidden from us. For example, when using React, we can update the state in response to a user request but the actual state transition cannot be accessed in test (e.g. to be awaited). It happens as a _side effect_. The thing is, we still have the intention we want to test coupled with that inaccessible side effect, so we need to account for it somehow.
66

77
Properly handling side effects, especially those we don't own (like state transition, browser navigation), is the key to eliminating flakiness in tests. In the end, we want _reliable_ tests, and side effects is the biggest contributing factor that makes them unpredictable.
88

0 commit comments

Comments
 (0)