Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

321
Vistas
Angular-testing-library: mi prueba no falla cuando se esperan valores incorrectos

Estoy usando angular-testing-library para mis pruebas de componentes. cuando se espera que falle, después de establecer el valor, mi caso de prueba no falla. alguien me ayuda? (título, título nuevo - @ entradas)

 import { render, screen } from '@testing-library/angular'; import userEvent from "@testing-library/user-event"; import { UserViewComponent } from './user-view.component'; import { provideMockStore } from "@ngrx/store/testing"; import { RouterTestingModule } from '@angular/router/testing'; import { ShellUserViewComponent } from '../../containers/shell-user-view/shell-user-view.component'; import { of } from 'rxjs'; describe('ShellUserViewComponent', () => { beforeEach(async () => { await render(ShellUserViewComponent, { componentProperties: { title: "welcome to Chennai", newTitle: "new title for test", users$: of([]) }, imports: [RouterTestingModule], declarations: [UserViewComponent], providers: [provideMockStore({})] }); }) it('should find the welcome as title', () => { expect(screen.findByText(/welcome to Chennaicc/i)).toBeTruthy(); //not failing cc added expect(screen.findByText(/new title for testx/i)).toBeTruthy(); //not failing x added }); });
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

findBy es asíncrono, por lo que debe esperarlo

 it('should find the welcome as title', async () => { expect(await screen.findByText(/welcome to Chennaicc/i)).toBeTruthy(); //not failing cc added expect(await screen.findByText(/new title for testx/i)).toBeTruthy(); //not failing x added });
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda