Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. //app.test.js
  2. import * as app from './app';
  3.  
  4.  
  5. describe('spy example', () => {
  6.  
  7. it('spy example', () => {
  8.  
  9. const spy = jest.spyOn(app, 'func1');
  10. app.func2();
  11. expect(spy).toHaveBeenCalledTimes(1);
  12. });
  13.  
  14. });
  15. //app.js
  16. export const func1 = () => {
  17.  
  18. }
  19.  
  20. export const func2 = () => {
  21. func1();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement