Skip to content

Commit 2a91ebf

Browse files
committed
Fix pre-existing test failures across datashare customizations
1 parent 4b551b2 commit 2a91ebf

16 files changed

Lines changed: 68 additions & 16 deletions

File tree

karma.conf.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ module.exports = function (config) {
3535
logLevel: config.LOG_INFO,
3636
autoWatch: true,
3737
browsers: ['Chrome'],
38+
browserDisconnectTimeout: 60000,
39+
browserNoActivityTimeout: 120000,
3840
singleRun: false,
3941
restartOnFileChange: true
4042
});

src/app/datashare/datashare-submission.service.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import { TestBed } from '@angular/core/testing';
2+
import { TranslateModule } from '@ngx-translate/core';
23

4+
import { NotificationsService } from '../shared/notifications/notifications.service';
5+
import { NotificationsServiceStub } from '../shared/testing/notifications-service.stub';
36
import { DatashareSubmissionService } from './datashare-submission.service';
47

58
describe('DatashareSubmissionService', () => {
69
let service: DatashareSubmissionService;
710

811
beforeEach(() => {
9-
TestBed.configureTestingModule({});
12+
TestBed.configureTestingModule({
13+
imports: [TranslateModule.forRoot()],
14+
providers: [
15+
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
16+
],
17+
});
1018
service = TestBed.inject(DatashareSubmissionService);
1119
});
1220

src/app/datashare/download-link.service.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { HttpClientTestingModule } from '@angular/common/http/testing';
12
import { TestBed } from '@angular/core/testing';
23

34
import { DownloadLinkService } from './download-link.service';
@@ -6,7 +7,9 @@ describe('DownloadLinkService', () => {
67
let service: DownloadLinkService;
78

89
beforeEach(() => {
9-
TestBed.configureTestingModule({});
10+
TestBed.configureTestingModule({
11+
imports: [HttpClientTestingModule],
12+
});
1013
service = TestBed.inject(DownloadLinkService);
1114
});
1215

src/app/info/about/about.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ describe('AboutComponent', () => {
1414

1515
beforeEach(waitForAsync(() => {
1616
TestBed.configureTestingModule({
17-
imports: [TranslateModule.forRoot()],
18-
declarations: [AboutComponent],
17+
imports: [TranslateModule.forRoot(), AboutComponent],
1918
schemas: [NO_ERRORS_SCHEMA],
2019
}).compileComponents();
2120
}));

src/app/info/copyright/copyright.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ describe('CopyrightComponent', () => {
1414

1515
beforeEach(waitForAsync(() => {
1616
TestBed.configureTestingModule({
17-
imports: [TranslateModule.forRoot()],
18-
declarations: [CopyrightComponent],
17+
imports: [TranslateModule.forRoot(), CopyrightComponent],
1918
schemas: [NO_ERRORS_SCHEMA],
2019
}).compileComponents();
2120
}));

src/app/info/organised/organised.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ describe('OrganisedComponent', () => {
1414

1515
beforeEach(waitForAsync(() => {
1616
TestBed.configureTestingModule({
17-
imports: [TranslateModule.forRoot()],
18-
declarations: [OrganisedComponent],
17+
imports: [TranslateModule.forRoot(), OrganisedComponent],
1918
schemas: [NO_ERRORS_SCHEMA],
2019
}).compileComponents();
2120
}));

src/app/item-page/field-components/metadata-uri-values/metadata-uri-values.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ let fixture: ComponentFixture<MetadataUriValuesComponent>;
2727
const mockMetadata = [
2828
{
2929
language: 'en_US',
30-
value: 'http://fakelink.org',
30+
value: 'https://doi.org/10.1234/fakelink',
3131
},
3232
{
3333
language: 'en_US',
34-
value: 'http://another.fakelink.org',
34+
value: 'https://doi.org/10.5678/another-fakelink',
3535
},
3636
] as MetadataValue[];
3737
const mockSeperator = '<br/>';

src/app/item-page/simple/field-components/file-section/file-section.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ describe('FileSectionComponent', () => {
169169
});
170170
it('should contain another bitstream', () => {
171171
const fileDownloadLink = fixture.debugElement.queryAll(By.css('ds-file-download-link'));
172-
expect(fileDownloadLink.length).toEqual(2);
172+
// DATASHARE: getNextPage() fetches both ORIGINAL and CC-LICENSE bundles
173+
expect(fileDownloadLink.length).toEqual(3);
173174
});
174175
});
175176
});

src/app/item-page/simple/field-components/specific-field/date/item-page-date-field.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { ItemPageDateFieldComponent } from './item-page-date-field.component';
2828
let comp: ItemPageDateFieldComponent;
2929
let fixture: ComponentFixture<ItemPageDateFieldComponent>;
3030

31-
const mockField = 'dc.date.issued';
31+
const mockField = 'dc.date.available';
3232
const mockValue = 'test value';
3333

3434
describe('ItemPageDateFieldComponent', () => {

src/app/item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let comp: ItemPageUriFieldComponent;
2727
let fixture: ComponentFixture<ItemPageUriFieldComponent>;
2828

2929
const mockField = 'dc.identifier.uri';
30-
const mockValue = 'test value';
30+
const mockValue = 'https://doi.org/10.1234/test';
3131
const mockLabel = 'test label';
3232

3333
describe('ItemPageUriFieldComponent', () => {

0 commit comments

Comments
 (0)