Skip to content

Commit

Permalink
Bump fetch-mock from 11.1.5 to 12.0.0 (#499)
Browse files Browse the repository at this point in the history
* Bump fetch-mock from 11.1.5 to 12.0.0

Bumps [fetch-mock](https://github.com/wheresrhys/fetch-mock/tree/HEAD/packages/fetch-mock) from 11.1.5 to 12.0.0.
- [Release notes](https://github.com/wheresrhys/fetch-mock/releases)
- [Changelog](https://github.com/wheresrhys/fetch-mock/blob/main/packages/fetch-mock/CHANGELOG.md)
- [Commits](https://github.com/wheresrhys/fetch-mock/commits/fetch-mock-v12.0.0/packages/fetch-mock)

---
updated-dependencies:
- dependency-name: fetch-mock
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Adapt to new fetch-mock API

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charlotte Van Petegem <[email protected]>
  • Loading branch information
dependabot[bot] and chvp authored Oct 26, 2024
1 parent eb63954 commit 4e8f5ef
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 41 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"estrella": "^1.4.1",
"fetch-mock": "^11.0.2",
"fetch-mock": "^12.0.0",
"globals": "^15.0.0",
"mocha": "^10.2.0",
"npm-dts": "^1.3.12",
Expand Down
7 changes: 5 additions & 2 deletions test/integration/albums.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("AlbumModule", function () {
module = new AlbumModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/albums?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/albums.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/albums?page=1",
);
});
});
7 changes: 5 additions & 2 deletions test/integration/artists.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("ArtistModule", function () {
module = new ArtistModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/artists?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/artists.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/artists?page=1",
);
});
});
4 changes: 2 additions & 2 deletions test/integration/auth_tokens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ suite("AuthTokenModule", function () {
module = new AuthTokenModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(
fetchMock.lastUrl(),
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/auth_tokens.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/auth_tokens?page=1",
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/integration/codec_conversions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ suite("CodecConversionModule", function () {
module = new CodecConversionModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(
fetchMock.lastUrl(),
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/codec_conversions.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/codec_conversions?page=1",
);
});
Expand Down
7 changes: 5 additions & 2 deletions test/integration/codecs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("CodecModule", function () {
module = new CodecModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/codecs?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/codecs.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/codecs?page=1",
);
});
});
4 changes: 2 additions & 2 deletions test/integration/cover_filenames.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ suite("CoverFilenameModule", function () {
module = new CoverFilenameModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(
fetchMock.lastUrl(),
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/cover_filenames.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/cover_filenames?page=1",
);
});
Expand Down
7 changes: 5 additions & 2 deletions test/integration/genres.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("GenreModule", function () {
module = new GenreModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/genres?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/genres.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/genres?page=1",
);
});
});
4 changes: 2 additions & 2 deletions test/integration/image_types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ suite("ImageTypeModule", function () {
module = new ImageTypeModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(
fetchMock.lastUrl(),
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/image_types.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/image_types?page=1",
);
});
Expand Down
7 changes: 5 additions & 2 deletions test/integration/labels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("LabelModule", function () {
module = new LabelModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/labels?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/labels.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/labels?page=1",
);
});
});
4 changes: 2 additions & 2 deletions test/integration/locations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ suite("LocationModule", function () {
module = new LocationModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(
fetchMock.lastUrl(),
fetchMock.callHistory.lastCall().url,

Check failure on line 21 in test/integration/locations.test.ts

View workflow job for this annotation

GitHub Actions / build

Property 'url' does not exist on type 'void | CallLog'.
"http://example.org/api/locations?page=1",
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/integration/playlists.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ suite("PlaylistModule", function () {
module = new PlaylistModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(
fetchMock.lastUrl(),
fetchMock.callHistory.lastCall().url,
"http://example.org/api/playlists?page=1",
);
});
Expand Down
7 changes: 5 additions & 2 deletions test/integration/plays.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("PlayModule", function () {
module = new PlayModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/plays?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,
"http://example.org/api/plays?page=1",
);
});
});
7 changes: 5 additions & 2 deletions test/integration/rescans.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("RescanModule", function () {
module = new RescanModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/rescans?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,
"http://example.org/api/rescans?page=1",
);
});
});
7 changes: 5 additions & 2 deletions test/integration/tracks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("TrackModule", function () {
module = new TrackModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/tracks?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,
"http://example.org/api/tracks?page=1",
);
});
});
7 changes: 5 additions & 2 deletions test/integration/users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ suite("UserModule", function () {
module = new UserModule("http://example.org/api");
});

teardown(fetchMock.resetHistory);
teardown(() => fetchMock.clearHistory());

test("should correctly call index path", async function () {
const index = module.index({ device_id: "abc", secret: "123" });
const response = await index.next();
assert(response.done);
assert.equal(response.value.length, 0);
assert.equal(fetchMock.lastUrl(), "http://example.org/api/users?page=1");
assert.equal(
fetchMock.callHistory.lastCall().url,
"http://example.org/api/users?page=1",
);
});
});
2 changes: 1 addition & 1 deletion test/mock-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fetchMock from "fetch-mock";
* Set up mockFetch and add routes
*/

global.fetch = fetchMock.sandbox();
fetchMock.mockGlobal();
fetchMock.get(
{
url: "http://example.org/api/albums?page=1",
Expand Down
25 changes: 16 additions & 9 deletions yarn.lock

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

0 comments on commit 4e8f5ef

Please sign in to comment.