11import { NO_ERRORS_SCHEMA } from '@angular/core' ;
2- import {
3- ComponentFixture ,
4- TestBed ,
5- waitForAsync ,
6- } from '@angular/core/testing' ;
2+ import { ComponentFixture , fakeAsync , TestBed , waitForAsync , } from '@angular/core/testing' ;
73import { By } from '@angular/platform-browser' ;
84import { RouterTestingModule } from '@angular/router/testing' ;
95import { TranslateModule } from '@ngx-translate/core' ;
106import { of } from 'rxjs' ;
117
12- import { AuditDataService } from '../../core/audit/audit-data.service' ;
8+ import { AuditDataService , AuditDetails } from '../../core/audit/audit-data.service' ;
139import { Audit } from '../../core/audit/model/audit.model' ;
1410import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service' ;
1511import { PaginationService } from '../../core/pagination/pagination.service' ;
1612import { PaginationComponent } from '../../shared/pagination/pagination.component' ;
17- import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils' ;
18- import { AuditMock } from '../../shared/testing/audit.mock' ;
13+ import { createSuccessfulRemoteDataObject , createSuccessfulRemoteDataObject $ } from '../../shared/remote-data.utils' ;
14+ import { AuditDetailsMock , AuditMock } from '../../shared/testing/audit.mock' ;
1915import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub' ;
20- import { createPaginatedList } from '../../shared/testing/utils.test' ;
2116import { VarDirective } from '../../shared/utils/var.directive' ;
2217import { AuditOverviewComponent } from './audit-overview.component' ;
18+ import { createPaginatedList } from '@shared/testing/utils.test' ;
2319
24- describe ( 'AuditOverviewComponent' , ( ) => {
20+ fdescribe ( 'AuditOverviewComponent' , ( ) => {
2521 let component : AuditOverviewComponent ;
2622 let fixture : ComponentFixture < AuditOverviewComponent > ;
2723
2824 let auditService : AuditDataService ;
2925 let authorizationService : any ;
3026 let audits : Audit [ ] ;
27+ let auditDetails : AuditDetails [ ] ;
3128 const paginationService = new PaginationServiceStub ( ) ;
3229
3330 function init ( ) {
34- audits = [ AuditMock , AuditMock , AuditMock ] ;
35- auditService = jasmine . createSpyObj ( 'processService' , {
31+ audits = [ AuditMock , AuditMock , AuditMock ] ;
32+ auditDetails = [ AuditDetailsMock , AuditDetailsMock , AuditDetailsMock ] ;
33+ auditService = jasmine . createSpyObj ( 'auditService' , {
3634 findAll : createSuccessfulRemoteDataObject$ ( createPaginatedList ( audits ) ) ,
3735 getEpersonName : of ( 'Eperson Name' ) ,
36+ mapToAuditDetails : createSuccessfulRemoteDataObject ( createPaginatedList ( auditDetails ) ) ,
37+ } ) ;
38+
39+ authorizationService = jasmine . createSpyObj ( 'authorizationService' , {
40+ isAuthorized : jasmine . createSpy ( 'isAuthorized' ) ,
3841 } ) ;
39- authorizationService = jasmine . createSpyObj ( 'authorizationService' , [ 'isAuthorized' ] ) ;
4042 }
4143
4244 beforeEach ( waitForAsync ( ( ) => {
@@ -54,13 +56,13 @@ describe('AuditOverviewComponent', () => {
5456
5557 describe ( 'if the current user is an admin' , ( ) => {
5658
57- beforeEach ( ( ) => {
58- authorizationService . isAuthorized . and . callFake ( ( ) => of ( true ) ) ;
59+ beforeEach ( fakeAsync ( ( ) => {
60+ authorizationService . isAuthorized . and . returnValue ( of ( true ) ) ;
5961
6062 fixture = TestBed . createComponent ( AuditOverviewComponent ) ;
6163 component = fixture . componentInstance ;
6264 fixture . detectChanges ( ) ;
63- } ) ;
65+ } ) ) ;
6466
6567 describe ( 'table structure' , ( ) => {
6668 let rowElements ;
@@ -118,7 +120,7 @@ describe('AuditOverviewComponent', () => {
118120 it ( 'should display the eperson name in the seventh column' , ( ) => {
119121 rowElements . forEach ( ( rowElement , index ) => {
120122 const el = rowElement . query ( By . css ( 'td:nth-child(7)' ) ) . nativeElement ;
121- expect ( el . textContent ) . toContain ( 'Eperson Name ' ) ;
123+ expect ( el . textContent ) . toContain ( 'Eperson Test ' ) ;
122124 } ) ;
123125 } ) ;
124126
0 commit comments