@@ -3,7 +3,7 @@ import { TestBed } from '@angular/core/testing';
33import { vi , test , expect , afterEach } from 'vitest' ;
44import { of , BehaviorSubject } from 'rxjs' ;
55import { debounceTime , switchMap , map , startWith } from 'rxjs/operators' ;
6- import { render , screen , waitFor , waitForElementToBeRemoved , within } from '../lib/testing-library' ;
6+ import { render , screen , waitForElementToBeRemoved , within } from '../lib/testing-library' ;
77import userEvent from '@testing-library/user-event' ;
88import { AsyncPipe , NgForOf } from '@angular/common' ;
99
@@ -98,7 +98,9 @@ afterEach(() => {
9898
9999async function setup ( ) {
100100 vi . useFakeTimers ( ) ;
101- const user = userEvent . setup ( ) ;
101+ const user = userEvent . setup ( {
102+ advanceTimers : vi . advanceTimersByTime ,
103+ } ) ;
102104
103105 await render ( EntitiesComponent , {
104106 providers : [
@@ -139,7 +141,7 @@ test('renders the entities', async () => {
139141 expect ( await screen . findByRole ( 'cell' , { name : / E n t i t y 3 / i } ) ) . toBeInTheDocument ( ) ;
140142} ) ;
141143
142- test . skip ( 'finds the cell' , async ( ) => {
144+ test ( 'finds the cell' , async ( ) => {
143145 const { user } = await setup ( ) ;
144146
145147 await user . type ( await screen . findByRole ( 'textbox' , { name : / S e a r c h e n t i t i e s / i } ) , 'Entity 2' , { } ) ;
@@ -150,9 +152,10 @@ test.skip('finds the cell', async () => {
150152 expect ( await screen . findByRole ( 'cell' , { name : / E n t i t y 2 / i } ) ) . toBeInTheDocument ( ) ;
151153} ) ;
152154
153- test . skip ( 'opens the modal' , async ( ) => {
155+ test ( 'opens the modal' , async ( ) => {
154156 const { modalMock, user } = await setup ( ) ;
155- await user . click ( await screen . findByRole ( 'button' , { name : / N e w E n t i t y / i } ) ) ;
157+
158+ await user . click ( await screen . findByRole ( 'button' , { name : / C r e a t e N e w E n t i t y / i } ) ) ;
156159 expect ( modalMock . open ) . toHaveBeenCalledWith ( 'new entity' ) ;
157160
158161 const row = await screen . findByRole ( 'row' , {
@@ -164,5 +167,6 @@ test.skip('opens the modal', async () => {
164167 name : / e d i t / i,
165168 } ) ,
166169 ) ;
167- await waitFor ( ( ) => expect ( modalMock . open ) . toHaveBeenCalledWith ( 'edit entity' , 'Entity 2' ) ) ;
170+
171+ await vi . waitFor ( ( ) => expect ( modalMock . open ) . toHaveBeenCalledWith ( 'edit entity' , 'Entity 2' ) ) ;
168172} ) ;
0 commit comments