Angular 6 unit testing component with DomSanitizer dependency
As a workaround, try add sanitize: () => 'safeString',
...
useValue: {
sanitize: () => 'safeString',
bypassSecurityTrustHtml: () => 'safeString'
}
...
If you want to preserve the value, use:
{
provide: DomSanitizer,
useValue: {
sanitize: (ctx: any, val: string) => val,
bypassSecurityTrustResourceUrl: (val: string) => val,
},
}