How to write unit test for switch case using jasmine
below is my code var s=function(){ return 'API CALL';//Through some API call i am getting and integer value }; switch(s()){ case 0: store.p1="Some Text"; break; case 1: store.p1="Some Other Text"; break; case 2: store.p1="Another Text"; break; } In the above function i am firing API call,which returns an integer value(0,1,2) and storing it in 's', i wanted to write unit test using jasmine..., could anyone please help how to write test case?! Note: 'store' is global variable and p1 is a another variable in 'store' where i want to store the value of 's'.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.