Skip to content

Commit

Permalink
Update first-test.md (#10244)
Browse files Browse the repository at this point in the history
Fixed minor typos
  • Loading branch information
LAdanimo authored and thedavidprice committed Mar 18, 2024
1 parent 54a4c6f commit 538fd34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docs/tutorial/chapter5/first-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ When trying to find the *full* text of the body, it should *not* be present.
```javascript
expect(matchedBody).toBeInTheDocument()
```
Assert that the truncated text is .
Assert that the truncated text is present.

```javascript
expect(ellipsis).toBeInTheDocument()
Expand All @@ -227,7 +227,7 @@ To double check that we're testing what we think we're testing, open up `Article

### What's the Deal with Mocks?

Did you wonder where the articles were coming from in our test? Was it the development database? Nope: that data came from a **Mock**. That's the `ArticlesCell.mock.js` file that lives next to your component, test and stories files. Mocks are used when you want to define the data that would normally be returned by GraphQL in your Storybook stories or tests. In cells, a GraphQL call goes out (the query defined by the variable `QUERY` at the top of the file) and returned to the `Success` component. We don't want to have to run the api-side server and have real data in the database just for Storybook or our tests, so Redwood intercepts those GraphQL calls and returns the data from the mock instead.
Did you wonder where the articles were coming from in our test? Was it the development database? Nope: that data came from a **Mock**. That's the `ArticlesCell.mock.js` file that lives next to your component, test and stories files. Mocks are used when you want to define the data that would normally be returned by GraphQL in your Storybook stories or tests. In cells, a GraphQL call goes out (the query defined by the variable `QUERY` at the top of the file) and is returned to the `Success` component. We don't want to have to run the api-side server and have real data in the database just for Storybook or our tests, so Redwood intercepts those GraphQL calls and returns the data from the mock instead.

:::info If the server is being mocked, how do we test the api-side code?

Expand Down

0 comments on commit 538fd34

Please sign in to comment.