Fixed build error

This commit is contained in:
Giuseppe Digilio
2019-01-17 11:53:00 +01:00
parent e6ec979d44
commit d76376ef92
13 changed files with 113 additions and 107 deletions

View File

@@ -46,7 +46,7 @@ describe('ItemDeleteComponent', () => {
}); });
mockItemDataService = jasmine.createSpyObj('mockItemDataService', { mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
delete: observableOf(new RestResponse(true, '200')) delete: observableOf(new RestResponse(true, 200, 'OK'))
}); });
routeStub = { routeStub = {
@@ -74,8 +74,8 @@ describe('ItemDeleteComponent', () => {
})); }));
beforeEach(() => { beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200'); successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, '500'); failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemDeleteComponent); fixture = TestBed.createComponent(ItemDeleteComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;

View File

@@ -1,21 +1,21 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {Item} from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import {RouterStub} from '../../../shared/testing/router-stub'; import { RouterStub } from '../../../shared/testing/router-stub';
import {of as observableOf} from 'rxjs'; import { of as observableOf } from 'rxjs';
import {RestResponse} from '../../../core/cache/response-cache.models'; import { RestResponse } from '../../../core/cache/response-cache.models';
import {RemoteData} from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service-stub'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
import {CommonModule} from '@angular/common'; import { CommonModule } from '@angular/common';
import {FormsModule} from '@angular/forms'; import { FormsModule } from '@angular/forms';
import {RouterTestingModule} from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import {TranslateModule} from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {ActivatedRoute, Router} from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import {ItemDataService} from '../../../core/data/item-data.service'; import { ItemDataService } from '../../../core/data/item-data.service';
import {NotificationsService} from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import {By} from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import {ItemPrivateComponent} from './item-private.component'; import { ItemPrivateComponent } from './item-private.component';
let comp: ItemPrivateComponent; let comp: ItemPrivateComponent;
let fixture: ComponentFixture<ItemPrivateComponent>; let fixture: ComponentFixture<ItemPrivateComponent>;
@@ -44,8 +44,8 @@ describe('ItemPrivateComponent', () => {
url: `${itemPageUrl}/edit` url: `${itemPageUrl}/edit`
}); });
mockItemDataService = jasmine.createSpyObj('mockItemDataService',{ mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
setDiscoverable: observableOf(new RestResponse(true, '200')) setDiscoverable: observableOf(new RestResponse(true, 200, 'OK'))
}); });
routeStub = { routeStub = {
@@ -62,10 +62,10 @@ describe('ItemPrivateComponent', () => {
imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()],
declarations: [ItemPrivateComponent], declarations: [ItemPrivateComponent],
providers: [ providers: [
{provide: ActivatedRoute, useValue: routeStub}, { provide: ActivatedRoute, useValue: routeStub },
{provide: Router, useValue: routerStub}, { provide: Router, useValue: routerStub },
{provide: ItemDataService, useValue: mockItemDataService}, { provide: ItemDataService, useValue: mockItemDataService },
{provide: NotificationsService, useValue: notificationsServiceStub}, { provide: NotificationsService, useValue: notificationsServiceStub },
], schemas: [ ], schemas: [
CUSTOM_ELEMENTS_SCHEMA CUSTOM_ELEMENTS_SCHEMA
] ]
@@ -73,8 +73,8 @@ describe('ItemPrivateComponent', () => {
})); }));
beforeEach(() => { beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200'); successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, '500'); failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemPrivateComponent); fixture = TestBed.createComponent(ItemPrivateComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;

View File

@@ -1,21 +1,21 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {Item} from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import {RouterStub} from '../../../shared/testing/router-stub'; import { RouterStub } from '../../../shared/testing/router-stub';
import {of as observableOf} from 'rxjs'; import { of as observableOf } from 'rxjs';
import {RestResponse} from '../../../core/cache/response-cache.models'; import { RestResponse } from '../../../core/cache/response-cache.models';
import {RemoteData} from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service-stub'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
import {CommonModule} from '@angular/common'; import { CommonModule } from '@angular/common';
import {FormsModule} from '@angular/forms'; import { FormsModule } from '@angular/forms';
import {RouterTestingModule} from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import {TranslateModule} from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {ActivatedRoute, Router} from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import {ItemDataService} from '../../../core/data/item-data.service'; import { ItemDataService } from '../../../core/data/item-data.service';
import {NotificationsService} from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import {By} from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import {ItemReinstateComponent} from './item-reinstate.component'; import { ItemReinstateComponent } from './item-reinstate.component';
let comp: ItemReinstateComponent; let comp: ItemReinstateComponent;
let fixture: ComponentFixture<ItemReinstateComponent>; let fixture: ComponentFixture<ItemReinstateComponent>;
@@ -44,8 +44,8 @@ describe('ItemReinstateComponent', () => {
url: `${itemPageUrl}/edit` url: `${itemPageUrl}/edit`
}); });
mockItemDataService = jasmine.createSpyObj('mockItemDataService',{ mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
setWithDrawn: observableOf(new RestResponse(true, '200')) setWithDrawn: observableOf(new RestResponse(true, 200, 'OK'))
}); });
routeStub = { routeStub = {
@@ -62,10 +62,10 @@ describe('ItemReinstateComponent', () => {
imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()], imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot()],
declarations: [ItemReinstateComponent], declarations: [ItemReinstateComponent],
providers: [ providers: [
{provide: ActivatedRoute, useValue: routeStub}, { provide: ActivatedRoute, useValue: routeStub },
{provide: Router, useValue: routerStub}, { provide: Router, useValue: routerStub },
{provide: ItemDataService, useValue: mockItemDataService}, { provide: ItemDataService, useValue: mockItemDataService },
{provide: NotificationsService, useValue: notificationsServiceStub}, { provide: NotificationsService, useValue: notificationsServiceStub },
], schemas: [ ], schemas: [
CUSTOM_ELEMENTS_SCHEMA CUSTOM_ELEMENTS_SCHEMA
] ]
@@ -73,8 +73,8 @@ describe('ItemReinstateComponent', () => {
})); }));
beforeEach(() => { beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200'); successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, '500'); failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemReinstateComponent); fixture = TestBed.createComponent(ItemReinstateComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;

View File

@@ -10,7 +10,7 @@ import { Router } from '@angular/router';
import { RouterStub } from '../../../shared/testing/router-stub'; import { RouterStub } from '../../../shared/testing/router-stub';
import { Item } from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
describe('ItemStatusComponent', () => { describe('ItemStatusComponent', () => {
let comp: ItemStatusComponent; let comp: ItemStatusComponent;

View File

@@ -1,21 +1,21 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {Item} from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import {RouterStub} from '../../../shared/testing/router-stub'; import { RouterStub } from '../../../shared/testing/router-stub';
import {of as observableOf} from 'rxjs'; import { of as observableOf } from 'rxjs';
import {RestResponse} from '../../../core/cache/response-cache.models'; import { RestResponse } from '../../../core/cache/response-cache.models';
import {RemoteData} from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service-stub'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
import {CommonModule} from '@angular/common'; import { CommonModule } from '@angular/common';
import {FormsModule} from '@angular/forms'; import { FormsModule } from '@angular/forms';
import {RouterTestingModule} from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import {TranslateModule} from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {ActivatedRoute, Router} from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import {ItemDataService} from '../../../core/data/item-data.service'; import { ItemDataService } from '../../../core/data/item-data.service';
import {NotificationsService} from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import {ItemWithdrawComponent} from './item-withdraw.component'; import { ItemWithdrawComponent } from './item-withdraw.component';
import {By} from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
let comp: ItemWithdrawComponent; let comp: ItemWithdrawComponent;
let fixture: ComponentFixture<ItemWithdrawComponent>; let fixture: ComponentFixture<ItemWithdrawComponent>;
@@ -44,8 +44,8 @@ describe('ItemWithdrawComponent', () => {
url: `${itemPageUrl}/edit` url: `${itemPageUrl}/edit`
}); });
mockItemDataService = jasmine.createSpyObj('mockItemDataService',{ mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
setWithDrawn: observableOf(new RestResponse(true, '200')) setWithDrawn: observableOf(new RestResponse(true, 200, 'OK'))
}); });
routeStub = { routeStub = {
@@ -62,10 +62,10 @@ describe('ItemWithdrawComponent', () => {
imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot(),], imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule.forRoot(),],
declarations: [ItemWithdrawComponent], declarations: [ItemWithdrawComponent],
providers: [ providers: [
{provide: ActivatedRoute, useValue: routeStub}, { provide: ActivatedRoute, useValue: routeStub },
{provide: Router, useValue: routerStub}, { provide: Router, useValue: routerStub },
{provide: ItemDataService, useValue: mockItemDataService}, { provide: ItemDataService, useValue: mockItemDataService },
{provide: NotificationsService, useValue: notificationsServiceStub}, { provide: NotificationsService, useValue: notificationsServiceStub },
], schemas: [ ], schemas: [
CUSTOM_ELEMENTS_SCHEMA CUSTOM_ELEMENTS_SCHEMA
] ]
@@ -73,8 +73,8 @@ describe('ItemWithdrawComponent', () => {
})); }));
beforeEach(() => { beforeEach(() => {
successfulRestResponse = new RestResponse(true, '200'); successfulRestResponse = new RestResponse(true, 200, 'OK');
failRestResponse = new RestResponse(false, '500'); failRestResponse = new RestResponse(false, 500, 'Internal Server Error');
fixture = TestBed.createComponent(ItemWithdrawComponent); fixture = TestBed.createComponent(ItemWithdrawComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;

View File

@@ -28,7 +28,7 @@ describe('ItemDataService', () => {
const responseCache = { const responseCache = {
get(href: string) { get(href: string) {
const responseCacheEntry = new ResponseCacheEntry(); const responseCacheEntry = new ResponseCacheEntry();
responseCacheEntry.response = new RestResponse(true, '200'); responseCacheEntry.response = new RestResponse(true, 200, 'OK');
return observableOf(responseCacheEntry); return observableOf(responseCacheEntry);
} }
} as ResponseCacheService; } as ResponseCacheService;
@@ -121,7 +121,7 @@ describe('ItemDataService', () => {
}); });
it('should setWithDrawn', () => { it('should setWithDrawn', () => {
const expected = new RestResponse(true, '200'); const expected = new RestResponse(true, 200, 'OK');
const result = service.setWithDrawn(scopeID, true); const result = service.setWithDrawn(scopeID, true);
result.subscribe((v) => expect(v).toEqual(expected)); result.subscribe((v) => expect(v).toEqual(expected));
@@ -143,7 +143,7 @@ describe('ItemDataService', () => {
}); });
it('should setDiscoverable', () => { it('should setDiscoverable', () => {
const expected = new RestResponse(true, '200'); const expected = new RestResponse(true, 200, 'OK');
const result = service.setDiscoverable(scopeID, false); const result = service.setDiscoverable(scopeID, false);
result.subscribe((v) => expect(v).toEqual(expected)); result.subscribe((v) => expect(v).toEqual(expected));
@@ -164,7 +164,7 @@ describe('ItemDataService', () => {
}); });
it('should delete the item', () => { it('should delete the item', () => {
const expected = new RestResponse(true, '200'); const expected = new RestResponse(true, 200, 'OK');
const result = service.delete(scopeID); const result = service.delete(scopeID);
result.subscribe((v) => expect(v).toEqual(expected)); result.subscribe((v) => expect(v).toEqual(expected));

View File

@@ -1018,7 +1018,7 @@ export const mockSubmissionDefinition: SubmissionDefinitionsModel = {
self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional' self: 'https://rest.api/dspace-spring-rest/api/config/submissiondefinitions/traditional'
} as any; } as any;
export const mockSubmissionState: SubmissionObjectState = { export const mockSubmissionState: SubmissionObjectState = Object.assign({}, {
826: { 826: {
collection: mockSubmissionCollectionId, collection: mockSubmissionCollectionId,
definition: 'traditional', definition: 'traditional',
@@ -1114,9 +1114,9 @@ export const mockSubmissionState: SubmissionObjectState = {
savePending: false, savePending: false,
depositPending: false depositPending: false
} }
}; });
export const mockSectionsState = { export const mockSectionsState = Object.assign({}, {
extraction: { extraction: {
config: '', config: '',
mandatory: true, mandatory: true,
@@ -1199,7 +1199,7 @@ export const mockSectionsState = {
isLoading: false, isLoading: false,
isValid: false isValid: false
} as any } as any
}; });
export const mockSectionsList = [ export const mockSectionsList = [
{ {

View File

@@ -33,7 +33,7 @@ describe('SubmissionFormComponent Component', () => {
const collectionId = mockSubmissionCollectionId; const collectionId = mockSubmissionCollectionId;
const submissionObjectNew: any = mockSubmissionObjectNew; const submissionObjectNew: any = mockSubmissionObjectNew;
const submissionDefinition: any = mockSubmissionDefinition; const submissionDefinition: any = mockSubmissionDefinition;
const submissionState: any = mockSubmissionState; const submissionState: any = Object.assign({}, mockSubmissionState);
const selfUrl: any = mockSubmissionSelfUrl; const selfUrl: any = mockSubmissionSelfUrl;
const sectionsList: any = mockSectionsList; const sectionsList: any = mockSectionsList;
const sectionsData: any = mockSectionsData; const sectionsData: any = mockSectionsData;

View File

@@ -61,6 +61,7 @@ describe('SubmissionObjectEffects test suite', () => {
const submissionDefinitionResponse: any = mockSubmissionDefinitionResponse; const submissionDefinitionResponse: any = mockSubmissionDefinitionResponse;
const submissionDefinition: any = mockSubmissionDefinition; const submissionDefinition: any = mockSubmissionDefinition;
const selfUrl: string = mockSubmissionSelfUrl; const selfUrl: string = mockSubmissionSelfUrl;
const submissionState: any = Object.assign({}, mockSubmissionState);
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -267,7 +268,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a UPLOAD_SECTION_DATA action for each updated section', () => { it('should return a UPLOAD_SECTION_DATA action for each updated section', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -315,7 +316,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should display a success notification', () => { it('should display a success notification', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -360,7 +361,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should display a warning notification when there are errors', () => { it('should display a warning notification when there are errors', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -407,7 +408,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should detect and notify a new section', () => { it('should detect and notify a new section', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -534,7 +535,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should not allow to deposit when there are errors', () => { it('should not allow to deposit when there are errors', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -608,7 +609,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DEPOSIT_SUBMISSION_SUCCESS action on success', () => { it('should return a DEPOSIT_SUBMISSION_SUCCESS action on success', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -634,7 +635,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DEPOSIT_SUBMISSION_ERROR action on error', () => { it('should return a DEPOSIT_SUBMISSION_ERROR action on error', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -718,7 +719,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DISCARD_SUBMISSION_SUCCESS action on success', () => { it('should return a DISCARD_SUBMISSION_SUCCESS action on success', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);
@@ -744,7 +745,7 @@ describe('SubmissionObjectEffects test suite', () => {
it('should return a DISCARD_SUBMISSION_ERROR action on error', () => { it('should return a DISCARD_SUBMISSION_ERROR action on error', () => {
store.nextState({ store.nextState({
submission: { submission: {
objects: mockSubmissionState objects: submissionState
} }
} as any); } as any);

View File

@@ -44,7 +44,11 @@ describe('submissionReducer test suite', () => {
const submissionDefinition = mockSubmissionDefinitionResponse; const submissionDefinition = mockSubmissionDefinitionResponse;
const selfUrl = mockSubmissionSelfUrl; const selfUrl = mockSubmissionSelfUrl;
const initState: SubmissionObjectState = mockSubmissionState; let initState: any;
beforeEach(() => {
initState = Object.assign({}, mockSubmissionState);
});
it('should init submission state properly', () => { it('should init submission state properly', () => {
const expectedState = { const expectedState = {
@@ -164,6 +168,7 @@ describe('submissionReducer test suite', () => {
depositPending: false depositPending: false
} }
}; };
const action = new CompleteInitSubmissionFormAction(submissionId); const action = new CompleteInitSubmissionFormAction(submissionId);
const newState = submissionObjectReducer(state, action); const newState = submissionObjectReducer(state, action);

View File

@@ -93,7 +93,7 @@ export class LicenseSectionComponent extends SectionModelComponent {
take(1), take(1),
filter((isReadOnly) => isReadOnly)) filter((isReadOnly) => isReadOnly))
.subscribe(() => { .subscribe(() => {
model.disabled = true; model.disabledUpdates.next(true);
}); });
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
}), }),

View File

@@ -41,7 +41,8 @@ describe('SectionsService test suite', () => {
const sectionId = 'traditionalpageone'; const sectionId = 'traditionalpageone';
const sectionErrors: any = parseSectionErrors(mockSectionsErrors); const sectionErrors: any = parseSectionErrors(mockSectionsErrors);
const sectionData: any = mockSectionsData; const sectionData: any = mockSectionsData;
const sectionState: any = mockSubmissionState['826'].sections[sectionId]; const submissionState: any = Object.assign({}, mockSubmissionState[submissionId]);
const sectionState: any = Object.assign({}, mockSubmissionState['826'].sections[sectionId]);
const store: any = jasmine.createSpyObj('store', { const store: any = jasmine.createSpyObj('store', {
dispatch: jasmine.createSpy('dispatch'), dispatch: jasmine.createSpy('dispatch'),
@@ -283,7 +284,7 @@ describe('SectionsService test suite', () => {
describe('isSectionAvailable', () => { describe('isSectionAvailable', () => {
it('should return an observable of true when section is available', () => { it('should return an observable of true when section is available', () => {
store.select.and.returnValue(observableOf(mockSubmissionState[submissionId])); store.select.and.returnValue(observableOf(submissionState));
const expected = cold('(b|)', { const expected = cold('(b|)', {
b: true b: true
@@ -293,7 +294,7 @@ describe('SectionsService test suite', () => {
}); });
it('should return an observable of false when section is not available', () => { it('should return an observable of false when section is not available', () => {
store.select.and.returnValue(observableOf(mockSubmissionState[submissionId])); store.select.and.returnValue(observableOf(submissionState));
const expected = cold('(b|)', { const expected = cold('(b|)', {
b: false b: false

View File

@@ -85,7 +85,7 @@ describe('UploadSectionComponent test suite', () => {
const submissionId = mockSubmissionId; const submissionId = mockSubmissionId;
const collectionId = mockSubmissionCollectionId; const collectionId = mockSubmissionCollectionId;
const submissionState = mockSubmissionState[mockSubmissionId]; const submissionState = Object.assign({}, mockSubmissionState[mockSubmissionId]);
const mockCollection = Object.assign(new Collection(), { const mockCollection = Object.assign(new Collection(), {
name: 'Community 1-Collection 1', name: 'Community 1-Collection 1',
id: collectionId, id: collectionId,
@@ -217,7 +217,6 @@ describe('UploadSectionComponent test suite', () => {
expect(compAsAny.fileList).toEqual([]); expect(compAsAny.fileList).toEqual([]);
expect(compAsAny.fileIndexes).toEqual([]); expect(compAsAny.fileIndexes).toEqual([]);
expect(compAsAny.fileNames).toEqual([]); expect(compAsAny.fileNames).toEqual([]);
// this.fileIndexes, this.fileNames).toEqual(expectedGroupsMap);
}); });