How to mock the url's query string in jasmine unit testing

784 views
Skip to first unread message

Varun Krishna Parthasarathy

unread,
Jan 29, 2014, 2:36:33 AM1/29/14
to jasmi...@googlegroups.com
Hi all,
I have a form which contains keyword text box, countryselect dropdown . and two buttons search, and clear.  The problem which I am facing here is this :
when the user enters some string in keyword  and then selects some country from the country list box, my url response in the firebug  is something like this 
http://localhost:pn/myAppname/page/?keyword = keyword &countryselect = countryselect  200 OK 
so for this I had written $httbackend mock  to test this 
//search-spec.js
describe('search spec', function(){
var keyword, countryselect; 
 
//... some  codes here  .......
it('should send a response to the server and return the search values', function () {
 keyword = keyword;
countryselect = countryselect;
var serv_resp = $httpBackend.When('GET', URL, + '?keyword = ' + keyword + '&countryselect = ' + countryselect);
//so here what my expectations should be
// is my code correct?  
}); 
})

Thanks,
Varun Krishna. P 
Reply all
Reply to author
Forward
0 new messages