Skip to content

Commit

Permalink
chore: add test-deploy workflow for docusaurus
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Jul 19, 2024
1 parent 5c8d863 commit 3be83e4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test deployment

on:
pull_request:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci
- name: Test build website
run: npm run build -w docs
10 changes: 7 additions & 3 deletions docs/fetch-mock/src/content/docs/API/Mocking/mock.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,24 @@ For complex matching (e.g. matching on headers in addition to url), there are 4
```js
fetchMock.mock({ url, headers }, response);
```
This has the advantage of keeping all the matching criteria in one place.

This has the advantage of keeping all the matching criteria in one place.

2. Pass in options in a third parameter e.g.

```js
fetchMock.mock(url, response, { headers });
```
This splits matching criteria between two parameters, which is arguably harder to read. However, if most of your tests only match on url, then this provides a convenient way to create a variant of an existing test.

This splits matching criteria between two parameters, which is arguably harder to read. However, if most of your tests only match on url, then this provides a convenient way to create a variant of an existing test.

3. Use a single object, e.g.

```js
fetchMock.mock({ url, response, headers });
```
Nothing wrong with doing this, but keeping response configuration in a separate argument to the matcher config feels like a good split.

Nothing wrong with doing this, but keeping response configuration in a separate argument to the matcher config feels like a good split.

4. Use a function matcher e.g.

Expand All @@ -65,6 +68,7 @@ fetchMock.mock((url, options) => {
// write your own logic
}, response);
```

Avoid using this unless you need to match on some criteria fetch-mock does not support.

## Examples
Expand Down

0 comments on commit 3be83e4

Please sign in to comment.