How do I spy on a function which is called by another function in Jasmine?
The expectation is true if I call this.bar() but I'm not interested on that.
Spec
import * as src from './src;
describe('app', () => {
it('should call bar', () => {
spyOn(src, 'bar');
src.foo();
expect(src.bar).toHaveBeenCalled();
});
});
Source
function foo() {
bar();
}
function bar() {
console.log('bar');
}
export {
foo,
bar,
};
Aucun commentaire:
Enregistrer un commentaire