Skip to content

Commit 1e25ca5

Browse files
[DSC-1932] Adjusted spec file
1 parent 9503390 commit 1e25ca5

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

src/app/shared/entity-dropdown/entity-dropdown.component.spec.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { createPaginatedList } from '../testing/utils.test';
1111
import { ItemExportFormatService } from '../../core/itemexportformat/item-export-format.service';
1212
import { of } from 'rxjs/internal/observable/of';
1313
import { 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+
2331
const 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

Comments
 (0)