Skip to content

Commit 3d8cda5

Browse files
committed
Add test
1 parent 1195815 commit 3d8cda5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/QueryParams.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,29 @@ it("can merge with the form method", () => {
168168
method: "get",
169169
});
170170
});
171+
172+
it("handles nested objects with undefined keys", () => {
173+
window.location.search = "?parent=og";
174+
175+
const query = (): {
176+
good: string;
177+
} => {
178+
const obj = {
179+
good: 'value',
180+
bad: undefined,
181+
}
182+
183+
return obj
184+
}
185+
186+
expect(
187+
index.form.head({
188+
mergeQuery: {
189+
parent: query(),
190+
},
191+
}),
192+
).toEqual({
193+
action: "/posts?parent=og&_method=HEAD&parent%5Bgood%5D=value",
194+
method: "get",
195+
});
196+
});

0 commit comments

Comments
 (0)