Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
bytesleo committed Aug 4, 2021
1 parent 8617534 commit 4aadb80
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 2 deletions.
1 change: 1 addition & 0 deletions __tests__/dogs.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Libs
import { create } from 'apisauce';

const api = create({
Expand Down
7 changes: 7 additions & 0 deletions docs/aws.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
---
title: AWS
parent: Libs
has_children: false
nav_order: 1
---

### Install

```bash
Expand Down
7 changes: 7 additions & 0 deletions docs/core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Core
has_children: true
nav_order: 5
---

# Core
2 changes: 1 addition & 1 deletion docs/enviroments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Environments
has_children: false
nav_order: 5
nav_order: 7
---

# Environments
Expand Down
9 changes: 8 additions & 1 deletion docs/fcm.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
### Install
---
title: FCM
parent: Libs
has_children: false
nav_order: 2
---

### FCM

```bash
yarn add fcm-push
Expand Down
7 changes: 7 additions & 0 deletions docs/libs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Libs
has_children: true
nav_order: 1
---

# Libs
34 changes: 34 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Unit tests
has_children: false
nav_order: 6
---

# Unit tests

To create unit tests, you must create a file with the extension **test.js** inside __test__ folder.

__test_/dogs.test.js

```javascript
// Libs
import { create } from 'apisauce';

const api = create({
baseURL: host
});

describe('Dogs', () => {
test('all dogs', async () => {
const { status, data } = await api.get('/api/dogs/all');
expect(200).toBe(status);
expect([]).toEqual(data);
});

test('all dogs - logged', async () => {
const { status, data } = await api.get('/api/dogs/all/logged');
expect(401).toBe(status);
expect('unauthorized').toEqual(data?.result);
});
});
```

0 comments on commit 4aadb80

Please sign in to comment.