Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
elbywan committed Jun 1, 2024
1 parent 3ff477e commit 9ac03ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/node/wretch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,10 @@ describe("Wretch", function () {
expect(w.query({ a: 1 }).query({}, true)._url).toBe(_URL)
})

it("should strip undefined values", function () {
it("should strip or omit undefined/null values", function () {
const w = wretch(_URL).addon(QueryStringAddon)
expect(w.query({ a: undefined, b: 1 })._url).toBe(_URL + "?a=&b=1")
expect(w.query({ a: undefined, b: 1, c: null }, false, true)._url).toBe(_URL + "?b=1")
expect(w.query({ array: ["a", "b", undefined, "c"] })._url).toBe(_URL + "?array=a&array=b&array=&array=c")
})
})
Expand Down

0 comments on commit 9ac03ab

Please sign in to comment.