Created
September 11, 2016 19:48
-
-
Save fonzerelly/539e51516c99c34a68dab659dc1010c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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