@@ -3,22 +3,16 @@ import { EntityDropdownComponent } from './entity-dropdown.component';
33import { getTestScheduler } from 'jasmine-marbles' ;
44import { createSuccessfulRemoteDataObject$ } from '../remote-data.utils' ;
55import { ItemType } from '../../core/shared/item-relationships/item-type.model' ;
6- import { ChangeDetectorRef , NO_ERRORS_SCHEMA , Pipe , PipeTransform } from '@angular/core' ;
6+ import { ChangeDetectorRef , NO_ERRORS_SCHEMA } from '@angular/core' ;
77import { EntityTypeDataService } from '../../core/data/entity-type-data.service' ;
88import { TestScheduler } from 'rxjs/testing' ;
99import { By } from '@angular/platform-browser' ;
1010import { 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-
15- // eslint-disable-next-line @angular-eslint/pipe-prefix
16- @Pipe ( { name : 'translate' } )
17- class MockTranslatePipe implements PipeTransform {
18- transform ( value : string ) : string {
19- return value ;
20- }
21- }
14+ import { TranslateService } from '@ngx-translate/core' ;
15+ import { SortPipe } from '../utils/sort.pipe' ;
2216
2317const entities : ItemType [ ] = [
2418 Object . assign ( new ItemType ( ) , {
@@ -91,18 +85,23 @@ describe('EntityDropdownComponent', () => {
9185 byEntityTypeAndMolteplicity : jasmine . createSpy ( 'byEntityTypeAndMolteplicity' )
9286 } ) ;
9387
94- let translatePipeSpy : jasmine . Spy ;
88+ const translateServiceMock : any = {
89+ instant ( name ) {
90+ return 'Statistics' ;
91+ }
92+ } ;
9593
9694 const paginatedEntities = createPaginatedList ( entities ) ;
9795 const paginatedEntitiesRD$ = createSuccessfulRemoteDataObject$ ( paginatedEntities ) ;
9896
9997 beforeEach ( waitForAsync ( ( ) => {
10098 TestBed . configureTestingModule ( {
10199 imports : [ ] ,
102- declarations : [ EntityDropdownComponent , MockTranslatePipe ] ,
100+ declarations : [ EntityDropdownComponent , SortPipe ] ,
103101 providers : [
104102 { provide : EntityTypeDataService , useValue : entityTypeServiceMock } ,
105103 { provide : ItemExportFormatService , useValue : itemExportFormatServiceMock } ,
104+ { provide : TranslateService , useValue : translateServiceMock } ,
106105 ChangeDetectorRef
107106 ] ,
108107 schemas : [ NO_ERRORS_SCHEMA ]
@@ -119,15 +118,6 @@ describe('EntityDropdownComponent', () => {
119118 componentAsAny . entityTypeService . getAllAuthorizedRelationshipTypeImport . and . returnValue ( paginatedEntitiesRD$ ) ;
120119 componentAsAny . itemExportFormatService . byEntityTypeAndMolteplicity . and . returnValue ( of ( entityFormatList ) ) ;
121120 component . isSubmission = true ;
122-
123- translatePipeSpy = spyOn ( MockTranslatePipe . prototype , 'transform' ) ;
124- } ) ;
125-
126- it ( 'should translate entries' , ( ) => {
127- scheduler . schedule ( ( ) => fixture . detectChanges ( ) ) ;
128- scheduler . flush ( ) ;
129-
130- expect ( translatePipeSpy ) . toHaveBeenCalledWith ( 'entity_1.listelement.badge' ) ;
131121 } ) ;
132122
133123 it ( 'should init component with entities list' , ( ) => {
0 commit comments