Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Jenya Mia
Added: Mar 19, 2019 12:53 PM
Modified: Mar 19, 2019 12:56 PM
Views: 27
Tags: karma testing
  1. it('should produce alert on functional search attempt', function(){
  2.         var alertSpy = spyOn(window, 'alert').and.callFake(function(){});
  3.         var searchString = 't:admin';
  4.  
  5.         //call method that displays alert
  6.  
  7.         expect(alertSpy).toHaveBeenCalledTimes(1);
  8.         expect(alertSpy).toHaveBeenCalledWith('alert_message');
  9.     });