Skip to content

Commit 95e7d98

Browse files
committed
add one extra test
1 parent 9c07c98 commit 95e7d98

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Below are some test cases the implementation doesn't handle well.
44
// Fix the implementation for these tests, and try to think of as many other edge cases as possible - write tests and fix those too.
55

6-
const parseQueryString = require("./querystring.js")
6+
const parseQueryString = require("./querystring.js");
77

88
test("should parse values containing '='", () => {
99
expect(parseQueryString("equation=a=b-2")).toEqual({
@@ -37,12 +37,15 @@ test("should replace '+' by ' '", () => {
3737
});
3838
});
3939

40+
test("should delete accidental '?' if first char by accident", () => {
41+
expect(parseQueryString("?colour=teal")).toEqual({ colour: "teal" });
42+
});
4043
// Stretch exercise: Handling query strings that contain identical keys
4144

42-
// Delete this test if you are not working on this optional case
43-
test("should store values of a key in an array when the key has 2 or more values", () => {
44-
expect(parseQueryString("key=value1&key=value2&key=value3&foo=bar")).toEqual({
45-
key: ["value1", "value2", "value3"],
46-
foo: "bar",
47-
});
48-
});
45+
// // Delete this test if you are not working on this optional case
46+
// test("should store values of a key in an array when the key has 2 or more values", () => {
47+
// expect(parseQueryString("key=value1&key=value2&key=value3&foo=bar")).toEqual({
48+
// key: ["value1", "value2", "value3"],
49+
// foo: "bar",
50+
// });
51+
// });

0 commit comments

Comments
 (0)