Here is my code:
var action = function getParam(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
var code = action("code");
//This is the test framework that I got
it("should return the first param of location search", function() {
var testCode =
//Here is where I want to call the function that tests my method.
expect(action("code")).toBe("testParam");
});
I am new to JavaScript and Jasmine Testing. Thank you very much for your help.
Aucun commentaire:
Enregistrer un commentaire