Skip to content

Commit

Permalink
Update dependencies (#20)
Browse files Browse the repository at this point in the history
* Update prettier

* Check prettier in lint script

* Update typescript

* Separate lint and typescript from test script

* Update jsdom

* Update eslint

* Remove regenerator-runtime

* Update cross-fetch to 4.0

* Fix npm commands in CI
  • Loading branch information
IanVS authored Jul 11, 2024
1 parent b8f69c1 commit 15be8e6
Show file tree
Hide file tree
Showing 8 changed files with 1,281 additions and 1,807 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run lint
- run: npm run tsc
- run: npm test
env:
CI: true
1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ module.exports = {
singleQuote: true,
printWidth: 120,
proseWrap: 'always',
trailingComma: 'es5',
};
25 changes: 10 additions & 15 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ MIT License

Copyright (c) 2017 Jeff Lau

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,13 @@ describe('getYear action creator', () => {

### Using `fetch.mock` to inspect the mock state of each fetch call

`fetch.mock` by default uses [Vitest's mocking functions](https://vitest.dev/api/mock.html). Therefore
you can make assertions on the mock state. In this example we have an arbitrary function that makes a different fetch
request based on the argument you pass to it. In our test, we run Vitest's `beforeEach()` and make sure to reset our
mock before each `it()` block as we will make assertions on the arguments we are passing to `fetch()`. Then we use the
`fetch.requests()` function to give us a history of all non-aborted requests (normalized) that were made. It can give you
information on each call, and their arguments which you can use for your `expect()` calls. Vitest also comes with some
nice aliases for the most used ones.
`fetch.mock` by default uses [Vitest's mocking functions](https://vitest.dev/api/mock.html). Therefore you can make
assertions on the mock state. In this example we have an arbitrary function that makes a different fetch request based
on the argument you pass to it. In our test, we run Vitest's `beforeEach()` and make sure to reset our mock before each
`it()` block as we will make assertions on the arguments we are passing to `fetch()`. Then we use the `fetch.requests()`
function to give us a history of all non-aborted requests (normalized) that were made. It can give you information on
each call, and their arguments which you can use for your `expect()` calls. Vitest also comes with some nice aliases for
the most used ones.

```js
// api.js
Expand Down Expand Up @@ -670,7 +670,7 @@ describe('testing api', () => {
APIRequest('twitter');

expect(fetch).toBeCalled(); // alias for expect(fetch.mock.calls.length).toEqual(1);
expect(fetch.requests().map(v => v.url)).toContain('https://twitter.com/');
expect(fetch.requests().map((v) => v.url)).toContain('https://twitter.com/');
});
});
```
Expand Down
Loading

0 comments on commit 15be8e6

Please sign in to comment.