Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

381
Views
Cómo corregir el valor inseguro utilizado en un contexto de URL de recurso en la prueba de unidad angular usando broma

Obtuve el siguiente error al escribir la prueba unitaria en Angular usando Jest. Revisé todas las sugerencias similares aquí en stackoverflow, pero ninguna fue útil.

Error: valor no seguro utilizado en un contexto de URL de recurso (ver https://g.co/ng/security#xss ) Broma

A continuación se muestra el código del archivo de prueba para su revisión.

 import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; import { MaterialModule } from '../../Material/material.module'; import { DashboardViewComponent } from './dashboard-view.component'; describe('DashboardViewComponent', () => { let component: DashboardViewComponent; let fixture: ComponentFixture<DashboardViewComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ RouterTestingModule, HttpClientTestingModule, MaterialModule, ], declarations: [ DashboardViewComponent ], providers: [{ provide: DomSanitizer, useValue: { bypassSecurityTrustResourceUrl: (): SafeResourceUrl => '' } }], schemas: [CUSTOM_ELEMENTS_SCHEMA] }) .compileComponents(); }); beforeEach(() => { fixture = TestBed.createComponent(DashboardViewComponent); component = fixture.componentInstance; fixture.detectChanges(); }); test('should create', () => { // expect(component).toMatchSnapshot(); expect(component).toBeTruthy(); }); });

Gracias por adelantado.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!