diff --git a/src/acp/policy.test.ts b/src/acp/policy.test.ts index e7d4c3f188..6a74825e75 100644 --- a/src/acp/policy.test.ts +++ b/src/acp/policy.test.ts @@ -56,11 +56,7 @@ const policyUrl = "https://some.pod/policy-resource"; describe("savePolicyDatasetAt", () => { it("sets the type of acp:AccessPolicy if not set yet", async () => { - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - const mockFetch = jest - .fn(window.fetch) - .mockResolvedValue(new Response() as any); + const mockFetch = jest.fn(window.fetch).mockResolvedValue(new Response()); const newDataset = createSolidDataset(); const savedDataset = await savePolicyDatasetAt(policyUrl, newDataset, { @@ -73,11 +69,7 @@ describe("savePolicyDatasetAt", () => { }); it("overwrites an existing type that might be set", async () => { - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - const mockFetch = jest - .fn(window.fetch) - .mockResolvedValue(new Response() as any); + const mockFetch = jest.fn(window.fetch).mockResolvedValue(new Response()); let newDatasetThing = createThing({ url: policyUrl }); newDatasetThing = setUrl( newDatasetThing, @@ -111,11 +103,7 @@ describe("savePolicyDatasetAt", () => { }); it("uses the given fetcher if provided", async () => { - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - const mockFetch = jest - .fn(window.fetch) - .mockResolvedValue(new Response() as any); + const mockFetch = jest.fn(window.fetch).mockResolvedValue(new Response()); await savePolicyDatasetAt(policyUrl, createSolidDataset(), { fetch: mockFetch, diff --git a/src/resource/nonRdfData.test.ts b/src/resource/nonRdfData.test.ts index 5e2b5e48a1..95ebe82c3d 100644 --- a/src/resource/nonRdfData.test.ts +++ b/src/resource/nonRdfData.test.ts @@ -490,10 +490,8 @@ describe("Write non-RDF data into a folder", () => { } as ResponseInit) ): MockFetch { fetch - // The type assertions to any are necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - .mockResolvedValueOnce(saveResponse as any) - .mockResolvedValueOnce(headResponse as any); + .mockResolvedValueOnce(saveResponse) + .mockResolvedValueOnce(headResponse); return fetch; } diff --git a/src/resource/resource.test.ts b/src/resource/resource.test.ts index d78280c6b6..fc393353b2 100644 --- a/src/resource/resource.test.ts +++ b/src/resource/resource.test.ts @@ -529,9 +529,7 @@ describe("getResourceInfo", () => { const mockFetch = jest.fn(window.fetch).mockResolvedValue( mockResponse(undefined, { url: "https://arbitrary.pod", - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - }) as any + }) ); const solidDatasetInfo = await getResourceInfo( @@ -551,11 +549,7 @@ describe("getResourceInfo", () => { // We need the type assertion because in non-mock situations, // you cannot set the URL manually: } as ResponseInit); - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - const mockFetch = jest - .fn(window.fetch) - .mockResolvedValue(mockResponse as any); + const mockFetch = jest.fn(window.fetch).mockResolvedValue(mockResponse); const solidDatasetInfo = await getResourceInfo( "https://some.pod/container/resource", diff --git a/src/resource/solidDataset.test.ts b/src/resource/solidDataset.test.ts index 8da767b84e..cbd367ba98 100644 --- a/src/resource/solidDataset.test.ts +++ b/src/resource/solidDataset.test.ts @@ -177,11 +177,7 @@ describe("getSolidDataset", () => { // We need the type assertion because in non-mock situations, // you cannot set the URL manually: } as ResponseInit); - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - const mockFetch = jest - .fn(window.fetch) - .mockResolvedValue(mockResponse as any); + const mockFetch = jest.fn(window.fetch).mockResolvedValue(mockResponse); const solidDataset = await getSolidDataset( "https://some.pod/container/resource", @@ -1050,11 +1046,11 @@ describe("deleteSolidDataset", () => { }); it("should DELETE a remote SolidDataset using the provided fetcher", async () => { - const mockFetch = jest.fn(window.fetch).mockResolvedValue( - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - new Response(undefined, { status: 200, statusText: "Deleted" }) as any - ); + const mockFetch = jest + .fn(window.fetch) + .mockResolvedValue( + new Response(undefined, { status: 200, statusText: "Deleted" }) + ); const response = await deleteSolidDataset("https://some.url", { fetch: mockFetch, @@ -1072,11 +1068,11 @@ describe("deleteSolidDataset", () => { }); it("should accept a fetched SolidDataset as target", async () => { - const mockFetch = jest.fn(window.fetch).mockResolvedValue( - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - new Response(undefined, { status: 200, statusText: "Deleted" }) as any - ); + const mockFetch = jest + .fn(window.fetch) + .mockResolvedValue( + new Response(undefined, { status: 200, statusText: "Deleted" }) + ); const mockSolidDataset = mockSolidDatasetFrom("https://some.url"); @@ -1100,9 +1096,7 @@ describe("deleteSolidDataset", () => { new Response(undefined, { status: 400, statusText: "Bad request", - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - }) as any + }) ); const deletionPromise = deleteSolidDataset("https://some.url", { @@ -1247,11 +1241,7 @@ describe("createContainerAt", () => { // We need the type assertion because in non-mock situations, // you cannot set the URL manually: } as ResponseInit); - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - const mockFetch = jest - .fn(window.fetch) - .mockResolvedValue(mockResponse as any); + const mockFetch = jest.fn(window.fetch).mockResolvedValue(mockResponse); const solidDataset = await createContainerAt( "https://some.pod/container/", @@ -1595,10 +1585,8 @@ describe("saveSolidDatasetInContainer", () => { } as ResponseInit) ): MockFetch { fetch - // The type assertions to any are necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - .mockResolvedValueOnce(saveResponse as any) - .mockResolvedValueOnce(headResponse as any); + .mockResolvedValueOnce(saveResponse) + .mockResolvedValueOnce(headResponse); return fetch; } @@ -1958,10 +1946,8 @@ describe("createContainerInContainer", () => { } as ResponseInit) ): MockFetch { fetch - // The type assertions to any are necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - .mockResolvedValueOnce(saveResponse as any) - .mockResolvedValueOnce(headResponse as any); + .mockResolvedValueOnce(saveResponse) + .mockResolvedValueOnce(headResponse); return fetch; } @@ -2246,11 +2232,11 @@ describe("deleteContainer", () => { }); it("should DELETE a remote Container using the provided fetcher", async () => { - const mockFetch = jest.fn(window.fetch).mockResolvedValue( - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - new Response(undefined, { status: 200, statusText: "Deleted" }) as any - ); + const mockFetch = jest + .fn(window.fetch) + .mockResolvedValue( + new Response(undefined, { status: 200, statusText: "Deleted" }) + ); const response = await deleteContainer("https://some.pod/container/", { fetch: mockFetch, @@ -2268,11 +2254,11 @@ describe("deleteContainer", () => { }); it("should accept a fetched Container as target", async () => { - const mockFetch = jest.fn(window.fetch).mockResolvedValue( - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - new Response(undefined, { status: 200, statusText: "Deleted" }) as any - ); + const mockFetch = jest + .fn(window.fetch) + .mockResolvedValue( + new Response(undefined, { status: 200, statusText: "Deleted" }) + ); const mockContainer = mockSolidDatasetFrom("https://some.pod/container/"); @@ -2305,9 +2291,7 @@ describe("deleteContainer", () => { new Response(undefined, { status: 400, statusText: "Bad request", - // The type assertion to any is necessary due to invalid Jest type definitions: - // https://github.com/facebook/jest/pull/10600 - }) as any + }) ); const deletionPromise = deleteContainer("https://some.pod/container/", {