title: Unsafe value used in a Resource context (iframe)
body: <p>I'm trying to test my component in which I use a presigned URL to render a PDF file from S3 and then i use a bypassSecurityTrustResourceUrl, and this works well, but just when I'm trying to test this component, I get the following error.</p>
  <p><a href="https://i.stack.imgur.com/jKM7V.png" rel="nofollow noreferrer">This is the error i'm getting</a></p>
  <p>This is my .spec</p>
  <pre><code>@Injectable()
  class MockService extends RestService{
    getPDFUrl(){
      return of({
        &quot;timestamp&quot;: &quot;2021-03-10T02:17:28.699Z&quot;,
        &quot;statusCode&quot;: 200,
        &quot;url&quot;: &quot;someURL&quot;
      })
    }
    getDocument() {
      {someinfo:&quot;infoo&quot;}
    }
  }
  describe('DashboardDetailsComponent', () =&gt; {
    let component: DashboardDetailsComponent;
    let fixture: ComponentFixture&lt;DashboardDetailsComponent&gt;;
  
    beforeEach(async () =&gt; {
      await TestBed.configureTestingModule({
        imports: [HomeModule, HomeRoutingModule, HttpClientModule, RouterTestingModule, NoopAnimationsModule, MatDialogModule ],
        declarations: [ DashboardDetailsComponent,  ],
        providers: [
          {
            provide: DomSanitizer,
            useValue: {
              sanitize: (ctx: any, val: string) =&gt; val,
              bypassSecurityTrustResourceUrl: (val: string) =&gt; val,
            },
          },
          // more providers
        ],
      })
      .compileComponents();
    });
  
    beforeEach(() =&gt; {
      fixture = TestBed.createComponent(DashboardDetailsComponent);
      component = fixture.componentInstance;
      fixture.detectChanges();
    });
  
    it('should create', () =&gt; {
      expect(component).toBeTruthy();
    });
  });
  </code></pre>
  <p>This is the html code where i used the url</p>
  <pre><code>&lt;iframe [src]='url || &quot;&quot;' width=&quot;100%&quot; height=&quot;350&quot;&gt;&lt;/iframe&gt;
  </code></pre>
  <p>This is the .ts code where i set the url</p>
  <pre><code>this._restService.getPDFUrl(this.document[0].templateURL).subscribe(data =&gt; {
          this.url = this._domSanitizer.bypassSecurityTrustResourceUrl(data.url);
        }, err =&gt; {
          this.failLoadDocument();
        });
  </code></pre>
  <p>If anyone can help me, I'm stucked on this error since yesterday.</p>