How do I add svg files via MatIconRegistry in unit tests?
问题 I'm currently implementing 'unit testing' in my angular application. However, if I run them, I receive multiple warnings/errors similar to this one: 'Error retrieving icon: Unable to find icon with the name ":myIcon"' . I suspect it might be caused by not adding the svgs to my MatIconRegistry. I usually do this in my AppComponent, like so: constuctor(private iconRegistry: MatIconRegistry, private sanitizer: DomSanitizer, ...) { iconRegistry.addSvgIcon('myIcon', sanitizer