lundi 4 avril 2016

How to Jasmine test javascript function with parameter

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 will provide the urlParameter code. I want to Jasmine test this function. Can anyone please provide me the guidance to do this? Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire