简体   繁体   中英

How to test shared component's method in Angular 2 unit testing?

How can I test a shared components method with Angular 2 unit testing? I need to test whether a shared components method has been called or not.

You can use spyOn or createSpy . About the difference between them: https://stackoverflow.com/a/45074442/5709697

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM