Skip to content

Commit aaae25b

Browse files
brentvatneFacebook Github Bot 1
authored andcommitted
Fix a typo and improve wording of docs in a few places
Summary:Docs are looking great these days 😎 -- here's my humble contribution Closes jestjs#830 Differential Revision: D3089990 fb-gh-sync-id: 78cb08e982fafa318df5e91164c375d6ab9122ff shipit-source-id: 78cb08e982fafa318df5e91164c375d6ab9122ff
1 parent 9c6f584 commit aaae25b

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

docs/CommonJSTesting.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ using a different approach.
1414
What is the problem?
1515
--------------------
1616

17-
The [example](https://docs.angularjs.org/guide/unit-testing#dependency-injection)
18-
that Angular documentation uses to justify Dependency Injection is the
19-
following:
20-
2117
```javascript
2218
function doWork() {
2319
const xhr = new XHR();
@@ -42,7 +38,7 @@ This small example shows two important concepts. We need a way to get a
4238
reference to `XHR` and a way to provide two implementations: one for the normal
4339
execution and one for testing.
4440

45-
In this case, the solution to both concepts is to use the global object. It
41+
In this case, the solution swaps implementations on the global object. It
4642
works, but it's not ideal for reasons outlined in this article:
4743
[Brittle Global State & Singletons](http://misko.hevery.com/code-reviewers-guide/flaw-brittle-global-state-singletons/).
4844

@@ -60,7 +56,7 @@ function doWork(XHR) {
6056
}
6157
```
6258

63-
It makes it very easy to write a test – you just pass your mocked version as
59+
It makes it very easy to write a test – you pass your mocked version as
6460
argument to your function:
6561

6662
```javascript

docs/Tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function fetchCurrentUser(callback) {
2727
return $.ajax({
2828
type: 'GET',
2929
url: 'http://example.com/currentUser',
30-
done: user => callback(parseJSON(user)),
30+
success: user => callback(parseJSON(user)),
3131
});
3232
}
3333

@@ -76,9 +76,9 @@ version of the real module – so we need to tell Jest not to mock the file we
7676
want to test or else `require('../fetchCurrentUser')` will return a mock.
7777

7878
In our first test, we want to confirm that calling `fetchCurrentUser()`
79-
properly incurs a call into `$.ajax()` with the parameters we expect. To do
80-
this, we just call `fetchCurrentUser()` with a dummy callback function, and
81-
then simply inspect the `$.ajax` mock to verify that it was called with the
79+
properly invokes `$.ajax()` with the parameters we expect. To do
80+
this, we call `fetchCurrentUser()` with a dummy callback function, and
81+
then inspect the `$.ajax` mock to verify that it was called with the
8282
correct parameters.
8383

8484
Woohoo! We've written our first test. But we're not quite done: We would still

0 commit comments

Comments
 (0)