Skip to content

Commit

Permalink
add one more test for multiple keys
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung committed Jan 6, 2025
1 parent 618e4c6 commit 9d0a056
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,22 @@ it("intercepts URLs with query parameters with repeated keys", async () => {
.intercept({ path: "/bar?a=1&a=2" })
.reply(200, "bar");

fetchMock
.get("https://example.com")
.intercept({ path: "/baz", query: { key1: ["a", "b"], key2: "c" } })
.reply(200, "baz");

let response1 = await fetch("https://example.com/foo?key=value");
expect(response1.url).toEqual("https://example.com/foo?key=value");
expect(await response1.text()).toBe("foo");

let response2 = await fetch("https://example.com/bar?a=1&a=2");
expect(response2.url).toEqual("https://example.com/bar?a=1&a=2");
expect(await response2.text()).toBe("bar");

let response3 = await fetch("https://example.com/baz?key1=a&key2=c&key1=b");
expect(response3.url).toEqual("https://example.com/baz?key1=a&key2=c&key1=b");
expect(await response3.text()).toBe("baz");
});

describe("AbortSignal", () => {
Expand Down

0 comments on commit 9d0a056

Please sign in to comment.