vendredi 22 mars 2019

How to mock js import in angular 5 in tests?

I'm trying to write tests for an angular 5 application which uses a js import, I've been doing research but i cant seen to figure out how to mock the js import. In the test, I just want to check that the bar() method has been called using a spyOn but can't figure out how to do this.

import {foo} from 'fooProject';

export class Component {
 constructor(){}

 trigger() {
  foo.bar();
 }
}

Aucun commentaire:

Enregistrer un commentaire