Skip to content

Commit

Permalink
chore(deps): update dependency node-fetch to v2.6.1 (#4995)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency node-fetch to v2.6.1

* tests: Use `toString()` method to test Buffer contents

As of `node-fetch@2.4.0`, its internal representation of `body` is now
normalized to a `Buffer` during `Request` construction, and will always be
returned as a `Buffer`, rather than having the `body` being either a String
_or_ a Buffer.  This defeated the way we were testing the `body` but
shouldn't affect the actual `Response`'s `body`.

Ref: node-fetch/node-fetch@7d3293200a91a

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jesse Rosenberger <git@jro.cc>
  • Loading branch information
3 people committed Apr 30, 2021
1 parent d6e7711 commit c0265ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@types/micro": "7.3.4",
"@types/nock": "10.0.3",
"@types/node": "8.10.65",
"@types/node-fetch": "2.5.8",
"@types/node-fetch": "2.5.10",
"@types/qs": "6.9.6",
"@types/qs-middleware": "1.0.1",
"@types/request": "2.48.5",
Expand Down Expand Up @@ -120,7 +120,7 @@
"memcached-mock": "0.1.0",
"mock-req": "0.2.0",
"nock": "10.0.6",
"node-fetch": "2.3.0",
"node-fetch": "2.6.1",
"prettier": "2.1.2",
"qs-middleware": "1.0.3",
"request": "2.88.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ describe('RESTDataSource', () => {

expect(fetch).toBeCalledTimes(1);
expect(fetch.mock.calls[0][0].url).toEqual('https://api.example.com/foo');
expect(fetch.mock.calls[0][0].body).toEqual(
expect(fetch.mock.calls[0][0].body.toString()).toEqual(
JSON.stringify({ foo: 'bar' }),
);
expect(fetch.mock.calls[0][0].headers.get('Content-Type')).toEqual(
Expand All @@ -285,7 +285,7 @@ describe('RESTDataSource', () => {

expect(fetch).toBeCalledTimes(1);
expect(fetch.mock.calls[0][0].url).toEqual('https://api.example.com/foo');
expect(fetch.mock.calls[0][0].body).toEqual(
expect(fetch.mock.calls[0][0].body.toString()).toEqual(
JSON.stringify(['foo', 'bar']),
);
expect(fetch.mock.calls[0][0].headers.get('Content-Type')).toEqual(
Expand Down Expand Up @@ -321,7 +321,7 @@ describe('RESTDataSource', () => {

expect(fetch).toBeCalledTimes(1);
expect(fetch.mock.calls[0][0].url).toEqual('https://api.example.com/foo');
expect(fetch.mock.calls[0][0].body).toEqual(
expect(fetch.mock.calls[0][0].body.toString()).toEqual(
JSON.stringify({ foo: 'bar' }),
);
expect(fetch.mock.calls[0][0].headers.get('Content-Type')).toEqual(
Expand Down Expand Up @@ -349,7 +349,7 @@ describe('RESTDataSource', () => {

expect(fetch).toBeCalledTimes(1);
expect(fetch.mock.calls[0][0].url).toEqual('https://api.example.com/foo');
expect(fetch.mock.calls[0][0].body).not.toEqual('{}');
expect(fetch.mock.calls[0][0].body.toString()).not.toEqual('{}');
expect(fetch.mock.calls[0][0].headers.get('Content-Type')).not.toEqual(
'application/json',
);
Expand Down

0 comments on commit c0265ac

Please sign in to comment.