Skip to content

Commit 78a88c6

Browse files
authored
Add tests for duplicate keys in query string parsing
Added tests for handling duplicate keys in query strings.
1 parent c9a22bb commit 78a88c6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎Sprint-2/implement/querystring.test.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ test("should replace '+' by ' '", () => {
3838
});
3939

4040
// Stretch exercise: Handling query strings that contain identical keys
41+
test("should handle multiple duplicate keys alongside single keys", () => {
42+
expect(parseQueryString("tag=js&tag=node&author=CYF")).toEqual({
43+
tag: ["js", "node"],
44+
author: "CYF",
45+
});
46+
});
4147

4248
// Delete this test if you are not working on this optional case
4349
test("should store values of a key in an array when the key has 2 or more values", () => {

0 commit comments

Comments
 (0)