Skip to content

Commit 4d512cc

Browse files
committed
touched up testing
1 parent 64b12d9 commit 4d512cc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/content/unit-testing-queries.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ postnumber: 18
1010

1111
In this part I'm going to show you how to write Unit tests for your functions. In theory We should've done this first, however, I wanted the GraphQL bits to go down first before we nailing down the unit tests.
1212

13-
in the tests folder create a file called getAllListings.test.js and add the following:
13+
In the `tests` folder create a file called `getAllListings.test.js` and add the following:
1414

1515
```javascript
1616
import { getAllListings, getAListing } from "../src/resolvers/query";
@@ -29,9 +29,9 @@ describe("All Listings", () => {
2929
3030
🎯 Jest allows us to first describe the test, then we can call the test function with whatever we want to test.
3131
32-
🎯 In our case we are first making sure it brings back the listings. We call the getAllListings Query and make sure the response has a listingId and it is greater than 1
32+
🎯 In our case we are first making sure it brings back the listings. We call the `getAllListings` Query and make sure the response has a `listingId` and it is greater than 1
3333
34-
Next we can test the getAListing function:
34+
Next we can test the `getAListing` function:
3535
3636
```javascript
3737
test("brings a listing", async () => {
@@ -43,11 +43,11 @@ test("brings a listing", async () => {
4343
})
4444
```
4545
46-
🎯 We are making sure that the listing that comes back matches the listingId we supplied to the query.
46+
🎯 We are making sure that the listing that comes back matches the `listingId` we supplied to the query.
4747
4848
Now if you run the following the test should pass:
4949
50-
```
50+
```javascript
5151
$ yarn test getAllListings.test.js
5252
```
5353

0 commit comments

Comments
 (0)