From f33b8214b8abf62297086c5e3a45e57e3f26616e Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Fri, 26 Apr 2024 15:35:43 -0400 Subject: [PATCH] Fix add-on test --- src/lib/api/addons.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/api/addons.test.ts b/src/lib/api/addons.test.ts index 7a5cb95a8..ac7bab1c9 100644 --- a/src/lib/api/addons.test.ts +++ b/src/lib/api/addons.test.ts @@ -17,7 +17,7 @@ describe("getAddons", () => { }); it("calls the addons API endpoint", async () => { await addons.getAddons({}, mockFetch); - const expectedEndpoint = new URL(`addons`, BASE_API_URL); + const expectedEndpoint = new URL("addons/", BASE_API_URL); expect(mockFetch).toHaveBeenCalledWith( expectedEndpoint, expect.any(Object), @@ -28,7 +28,7 @@ describe("getAddons", () => { { active: true, featured: true, query: "foobar" }, mockFetch, ); - const expectedEndpoint = new URL(`addons`, BASE_API_URL); + const expectedEndpoint = new URL("addons/", BASE_API_URL); expectedEndpoint.searchParams.set("active", "true"); expectedEndpoint.searchParams.set("featured", "true"); expectedEndpoint.searchParams.set("query", "foobar"); @@ -57,7 +57,7 @@ test("getPinnedAddons", async () => { .mockResolvedValue({ ok: true, json: async () => {} }); await addons.getPinnedAddons(mockFetch); expect(mockFetch).toHaveBeenCalledWith( - new URL(`addons?active=true`, BASE_API_URL), + new URL(`addons/?active=true`, BASE_API_URL), expect.any(Object), ); }); @@ -76,7 +76,7 @@ describe("getAddon", async () => { it("calls the addons list endpoint with a respository query argument", async () => { await addons.getAddon("MuckRock", "addon-repo", mockFetch); expect(mockFetch).toHaveBeenCalledWith( - new URL(`addons?repository=MuckRock%2Faddon-repo`, BASE_API_URL), + new URL(`addons/?repository=MuckRock%2Faddon-repo`, BASE_API_URL), expect.any(Object), ); });