Skip to content

Commit cb2f7ae

Browse files
author
Andrea Barbasso
committed
[DSC-2858] fix tests
1 parent 55c45ae commit cb2f7ae

7 files changed

Lines changed: 29 additions & 10 deletions

File tree

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ describe('EPersonFormComponent', () => {
323323
beforeEach(() => {
324324
component.formGroup.controls.firstName.setValue('test');
325325
component.formGroup.controls.lastName.setValue('test');
326-
component.formGroup.controls.email.setValue('TEST@test.com');
326+
component.formGroup.controls.email.setValue('test@test.com');
327327
fixture.detectChanges();
328328
});
329329

@@ -340,7 +340,7 @@ describe('EPersonFormComponent', () => {
340340
});
341341
it('email should not be valid because the email pattern', () => {
342342
expect(component.formGroup.controls.email.valid).toBeFalse();
343-
expect(component.formGroup.controls.email.errors.email).toBeTruthy();
343+
expect(component.formGroup.controls.email.errors.pattern).toBeTruthy();
344344
});
345345
});
346346

src/app/core/auth/auth.effects.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ describe('AuthEffects', () => {
198198
const expected = cold('--b-', { b: new AuthenticatedErrorAction(new Error('Message Error test')) });
199199

200200
expect(authEffects.authenticated$).toBeObservable(expected);
201+
done();
201202
});
202203
});
203204

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/attachment/attachment.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { createPaginatedList } from '../../../../../../../shared/testing/utils.t
3333
import { TruncatableComponent } from '../../../../../../../shared/truncatable/truncatable.component';
3434
import { TruncatablePartComponent } from '../../../../../../../shared/truncatable/truncatable-part/truncatable-part.component';
3535
import { FileSizePipe } from '../../../../../../../shared/utils/file-size-pipe';
36+
import { LocaleService } from '../../../../../../../core/locale/locale.service';
3637
import { FieldRenderingType } from '../field-rendering-type';
3738
import { AttachmentComponent } from './attachment.component';
3839

@@ -171,6 +172,7 @@ describe('AttachmentComponent', () => {
171172
{ provide: 'tabNameProvider', useValue: '' },
172173
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
173174
{ provide: AuthorizationDataService, useValue: mockAuthorizedService },
175+
{ provide: LocaleService, useValue: { getCurrentLanguageCode: () => of('en') } },
174176
],
175177
schemas: [NO_ERRORS_SCHEMA],
176178
};

src/app/item-page/mirador-viewer/mirador-viewer.component.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ describe('MiradorViewerComponent in development mode', () => {
218218
});
219219

220220
it('should not embed the viewer', async () => {
221-
await fixture.whenStable();
222-
comp.iframeViewerUrl = of('testUrl');
223-
viewerService.showEmbeddedViewer.and.returnValue(false);
224-
comp.getURL = () => null;
221+
fixture = TestBed.createComponent(MiradorViewerComponent);
222+
comp = fixture.componentInstance;
223+
comp.object = getItem(noMetadata);
225224
comp.searchable = false;
226-
comp.ngOnInit();
225+
comp.getURL = () => null;
227226
fixture.detectChanges();
227+
await fixture.whenStable();
228228
const value = fixture.debugElement
229229
.nativeElement.querySelector('#mirador-viewer');
230230
expect(value).toBeNull();

src/app/lucky-search/search/lucky-search.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { createPaginatedList } from '../../shared/testing/utils.test';
5151
import { TruncatableComponent } from '../../shared/truncatable/truncatable.component';
5252
import { TruncatablePartComponent } from '../../shared/truncatable/truncatable-part/truncatable-part.component';
5353
import { FileSizePipe } from '../../shared/utils/file-size-pipe';
54+
import { LocaleService } from '../../core/locale/locale.service';
5455
import { LuckySearchService } from '../lucky-search.service';
5556
import { LuckySearchComponent } from './lucky-search.component';
5657

@@ -133,6 +134,7 @@ describe('LuckySearchComponent', () => {
133134
{ provide: PLATFORM_ID, useValue: 'browser' },
134135
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
135136
{ provide: APP_CONFIG, useValue: {} },
137+
{ provide: LocaleService, useValue: { getCurrentLanguageCode: () => of('en') } },
136138
],
137139
}).overrideComponent(LuckySearchComponent, {
138140
remove: {

src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-inline-group/dynamic-relation-inline-group.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
DynamicFormLayoutService,
2626
DynamicFormValidationService,
2727
} from '@ng-dynamic-forms/core';
28+
import { ScannedActionsSubject } from '@ngrx/store';
2829
import { provideMockStore } from '@ngrx/store/testing';
2930
import { TranslateModule } from '@ngx-translate/core';
3031
import { of } from 'rxjs';
@@ -195,6 +196,7 @@ describe('DsDynamicRelationInlineGroupComponent test suite', () => {
195196
{ provide: SubmissionObjectDataService, useValue: {} },
196197
{ provide: XSRFService, useValue: {} },
197198
{ provide: LiveRegionService, useValue: {} },
199+
{ provide: ScannedActionsSubject, useValue: new ScannedActionsSubject() },
198200
{ provide: APP_CONFIG, useValue: environment },
199201
{ provide: APP_DATA_SERVICES_MAP, useValue: {} },
200202
{ provide: DYNAMIC_FORM_CONTROL_MAP_FN, useValue: dsDynamicFormControlMapFn },

src/app/statistics-page/cris-statistics-page/cris-statistics-page.component.spec.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ import {
1414
TranslateLoader,
1515
TranslateModule,
1616
} from '@ngx-translate/core';
17+
import {
18+
NgbNav,
19+
NgbNavContent,
20+
NgbNavItem,
21+
NgbNavLink,
22+
NgbNavModule,
23+
} from '@ng-bootstrap/ng-bootstrap';
1724
import { of } from 'rxjs';
1825

1926
import { AuthService } from '../../core/auth/auth.service';
@@ -80,6 +87,10 @@ describe('CrisStatisticsPageComponent', () => {
8087
},
8188
}),
8289
CrisStatisticsPageComponent,
90+
NgbNav,
91+
NgbNavItem,
92+
NgbNavLink,
93+
NgbNavContent,
8394
],
8495
providers: [
8596
provideMockStore({ initialState }),
@@ -91,7 +102,7 @@ describe('CrisStatisticsPageComponent', () => {
91102
],
92103
schemas: [NO_ERRORS_SCHEMA],
93104
})
94-
.overrideComponent(CrisStatisticsPageComponent, { remove: { imports: [ThemedLoadingComponent, StatisticsMapComponent, StatisticsChartComponent] } }).compileComponents();
105+
.overrideComponent(CrisStatisticsPageComponent, { remove: { imports: [ThemedLoadingComponent, StatisticsMapComponent, StatisticsChartComponent, NgbNavModule] }, add: { imports: [NgbNav, NgbNavItem, NgbNavLink, NgbNavContent] } }).compileComponents();
95106
});
96107

97108
beforeEach(() => {
@@ -143,8 +154,9 @@ describe('CrisStatisticsPageComponent', () => {
143154
component.selectedCategory = data[0];
144155
});
145156
fixture.detectChanges();
146-
const renderedCategories = fixture.debugElement.queryAll(By.css('#categories-tabs li a'));
147-
expect(renderedCategories[0].nativeElement.classList.contains('active')).toBe(true);
157+
const renderedLinks = fixture.debugElement.queryAll(By.css('#categories-tabs li a'));
158+
expect(renderedLinks.length).toBe(2);
159+
expect(renderedLinks[0].nativeElement.classList.contains('active')).toBe(true);
148160
});
149161

150162
it('should set selectedReportId to the first report id if no reportType query param is present', () => {

0 commit comments

Comments
 (0)