license import { MAT_DIALOG_DATA } from '@angular/material/dialog' ; import { createComponentFactory , Spectator } from '@ngneat/spectator/jest' ; import { LogReportDialogComponent } from './log-report-dialog.component' ; import { LogReportDialogData } from './types' ; describe ( 'LogReportDialogComponent' , ( ) => { let spectator ; const createComponent = createComponentFactory ( LogReportDialogComponent ) ; it ( 'should create without unsafe url' , ( ) => { const dialogData = { title : 'My title' , message : 'My message' , } ; spectator = createComponent ( { providers : [ { provide : MAT_DIALOG_DATA , useValue : dialogData , } , ] , } ) ; const downloadEl = spectator . query ( 'a' ) ; if ( ! downloadEl ) { throw new Error ( 'Anchor not found' ) ; } expect ( downloadEl . href ) . not . toMatch ( /^unsafe:/ ) ; } ) ; } ) ;