vendredi 5 juin 2020

How to write test cases for custom event listeners in jasmine

This is the function i want to create test cases for with spies or mock classes. I am not able to cover the entire function.

zone = new NgZone({enableLongStackTrace : false})
getEvents(){
    return Observable.create(observer => {
        return someService.someSubject.subscribe(someObj => {
            someObj.addEventListener('eventName' , event => {
                this.zone.run(() => {
                   observer.next(event);
                });
            });
        });
    });
}

Aucun commentaire:

Enregistrer un commentaire