@@ -11,6 +11,7 @@ import { createPaginatedList } from '../testing/utils.test';
1111import { ItemExportFormatService } from '../../core/itemexportformat/item-export-format.service' ;
1212import { of } from 'rxjs/internal/observable/of' ;
1313import { ItemExportFormat , ItemExportFormatMap } from '../../core/itemexportformat/model/item-export-format.model' ;
14+ import { TranslateService } from '@ngx-translate/core' ;
1415
1516// eslint-disable-next-line @angular-eslint/pipe-prefix
1617@Pipe ( { name : 'translate' } )
@@ -20,6 +21,13 @@ class MockTranslatePipe implements PipeTransform {
2021 }
2122}
2223
24+ @Pipe ( { name : 'dsSort' } )
25+ class MockDsSortPipe implements PipeTransform {
26+ transform ( value : any [ ] , column : string = '' , order : 'asc' | 'desc' = 'asc' ) : any [ ] {
27+ return value ;
28+ }
29+ }
30+
2331const entities : ItemType [ ] = [
2432 Object . assign ( new ItemType ( ) , {
2533 id : 'ce64f48e-2c9b-411a-ac36-ee429c0e6a88' ,
@@ -91,6 +99,12 @@ describe('EntityDropdownComponent', () => {
9199 byEntityTypeAndMolteplicity : jasmine . createSpy ( 'byEntityTypeAndMolteplicity' )
92100 } ) ;
93101
102+ const translateServiceMock : any = {
103+ instant ( name ) {
104+ return 'Statistics' ;
105+ }
106+ } ;
107+
94108 let translatePipeSpy : jasmine . Spy ;
95109
96110 const paginatedEntities = createPaginatedList ( entities ) ;
@@ -99,10 +113,11 @@ describe('EntityDropdownComponent', () => {
99113 beforeEach ( waitForAsync ( ( ) => {
100114 TestBed . configureTestingModule ( {
101115 imports : [ ] ,
102- declarations : [ EntityDropdownComponent , MockTranslatePipe ] ,
116+ declarations : [ EntityDropdownComponent , MockTranslatePipe , MockDsSortPipe ] ,
103117 providers : [
104118 { provide : EntityTypeDataService , useValue : entityTypeServiceMock } ,
105119 { provide : ItemExportFormatService , useValue : itemExportFormatServiceMock } ,
120+ { provide : TranslateService , useValue : translateServiceMock } ,
106121 ChangeDetectorRef
107122 ] ,
108123 schemas : [ NO_ERRORS_SCHEMA ]
@@ -123,13 +138,6 @@ describe('EntityDropdownComponent', () => {
123138 translatePipeSpy = spyOn ( MockTranslatePipe . prototype , 'transform' ) ;
124139 } ) ;
125140
126- it ( 'should translate entries' , ( ) => {
127- scheduler . schedule ( ( ) => fixture . detectChanges ( ) ) ;
128- scheduler . flush ( ) ;
129-
130- expect ( translatePipeSpy ) . toHaveBeenCalledWith ( 'entity_1.listelement.badge' ) ;
131- } ) ;
132-
133141 it ( 'should init component with entities list' , ( ) => {
134142 spyOn ( component . subs , 'push' ) ;
135143 spyOn ( component , 'resetPagination' ) ;
0 commit comments