Fix this test

This commit is contained in:
shamoon 2024-12-04 23:41:13 -08:00
parent 0c469f731d
commit f0de7cfe02
No known key found for this signature in database

View File

@ -187,7 +187,7 @@ describe('SavedViewWidgetComponent', () => {
fixture.detectChanges() fixture.detectChanges()
}) })
it('should show a list of documents', () => { it('should show a list of documents', fakeAsync(() => {
jest.spyOn(documentService, 'listFiltered').mockReturnValue( jest.spyOn(documentService, 'listFiltered').mockReturnValue(
of({ of({
all: [2, 3], all: [2, 3],
@ -196,6 +196,7 @@ describe('SavedViewWidgetComponent', () => {
}) })
) )
component.ngOnInit() component.ngOnInit()
tick(500)
fixture.detectChanges() fixture.detectChanges()
expect(fixture.debugElement.nativeElement.textContent).toContain('doc2') expect(fixture.debugElement.nativeElement.textContent).toContain('doc2')
expect(fixture.debugElement.nativeElement.textContent).toContain('doc3') expect(fixture.debugElement.nativeElement.textContent).toContain('doc3')
@ -206,7 +207,7 @@ describe('SavedViewWidgetComponent', () => {
expect( expect(
fixture.debugElement.queryAll(By.css('td a.btn'))[1].attributes['href'] fixture.debugElement.queryAll(By.css('td a.btn'))[1].attributes['href']
).toEqual(component.getDownloadUrl(documentResults[0])) ).toEqual(component.getDownloadUrl(documentResults[0]))
}) }))
it('should call api endpoint and load results', () => { it('should call api endpoint and load results', () => {
const listAllSpy = jest.spyOn(documentService, 'listFiltered') const listAllSpy = jest.spyOn(documentService, 'listFiltered')