Skip to content

Instantly share code, notes, and snippets.

@fonzerelly
Created September 11, 2016 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fonzerelly/539e51516c99c34a68dab659dc1010c4 to your computer and use it in GitHub Desktop.
Save fonzerelly/539e51516c99c34a68dab659dc1010c4 to your computer and use it in GitHub Desktop.
var UrlSearch = require("./url-search");
describe("objectizeUrlSearch", function () {
it("should convert search string to search object", function() {
var
urlSearch = "a=1&a=2&b=3",
searchObject = {
"a": ["1","2"],
"b": "3"
};
expect(UrlSearch.objectizeUrlSearch(urlSearch))
.toEqual(searchObject);
});
it("should return empty object if empty string got passed", function () {
expect(UrlSearch.objectizeUrlSearch(""))
.toEqual({});
});
it("should return undefined param if value is missing", function () {
expect(UrlSearch.objectizeUrlSearch("param"))
.toEqual({"param": null});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment