Skip to content

Commit

Permalink
docs: add test case for #492
Browse files Browse the repository at this point in the history
  • Loading branch information
timdeschryver committed Oct 14, 2024
1 parent fbbed20 commit be9c3d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions projects/testing-library/tests/issues/issue-492.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AsyncPipe } from '@angular/common';
import { Component, inject, Injectable } from '@angular/core';
import { render, screen, waitFor } from '../../src/public_api';
import { render, screen } from '../../src/public_api';
import { Observable, BehaviorSubject, map } from 'rxjs';

test('displays username', async () => {
Expand All @@ -21,13 +21,13 @@ test('displays username', async () => {
});

// assert first username emitted is rendered
expect(await screen.findByRole('heading')).toHaveTextContent('username 1');
expect(await screen.findByRole('heading', { name: 'username 1' })).toBeInTheDocument();

// emitting a second username
user.next({ name: 'username 2' });

// assert the second username is rendered
await waitFor(() => expect(screen.getByRole('heading')).toHaveTextContent('username 2'));
expect(await screen.findByRole('heading', { name: 'username 2' })).toBeInTheDocument();
});

@Component({
Expand Down

0 comments on commit be9c3d5

Please sign in to comment.