Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //app.test.js
- import * as app from './app';
- describe('spy example', () => {
- it('spy example', () => {
- const spy = jest.spyOn(app, 'func1');
- app.func2();
- expect(spy).toHaveBeenCalledTimes(1);
- });
- });
- //app.js
- export const func1 = () => {
- }
- export const func2 = () => {
- func1();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement