"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.spec.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

my-dspace-new-submission.component.spec.ts  (dspace-angular-dspace-7.0):my-dspace-new-submission.component.spec.ts  (dspace-angular-dspace-7.1)
import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core'; import { ChangeDetectorRef, Component, NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t esting'; import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t esting';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { By } from '@angular/platform-browser';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to'; import { ScrollToService } from '@nicky-lenaers/ngx-scroll-to';
import { NgbModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { HALEndpointService } from '../../core/shared/hal-endpoint.service'; import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
import { AuthServiceStub } from '../../shared/testing/auth-service.stub'; import { AuthServiceStub } from '../../shared/testing/auth-service.stub';
import { AuthService } from '../../core/auth/auth.service'; import { AuthService } from '../../core/auth/auth.service';
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-servic e.stub'; import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-servic e.stub';
import { createTestComponent } from '../../shared/testing/utils.test'; import { createTestComponent } from '../../shared/testing/utils.test';
skipping to change at line 28 skipping to change at line 27
import { NotificationsServiceStub } from '../../shared/testing/notifications-ser vice.stub'; import { NotificationsServiceStub } from '../../shared/testing/notifications-ser vice.stub';
import { getMockScrollToService } from '../../shared/mocks/scroll-to-service.moc k'; import { getMockScrollToService } from '../../shared/mocks/scroll-to-service.moc k';
import { UploaderService } from '../../shared/uploader/uploader.service'; import { UploaderService } from '../../shared/uploader/uploader.service';
import { HostWindowService } from '../../shared/host-window.service'; import { HostWindowService } from '../../shared/host-window.service';
import { HostWindowServiceStub } from '../../shared/testing/host-window-service. stub'; import { HostWindowServiceStub } from '../../shared/testing/host-window-service. stub';
import { UploaderComponent } from '../../shared/uploader/uploader.component'; import { UploaderComponent } from '../../shared/uploader/uploader.component';
import { HttpXsrfTokenExtractor } from '@angular/common/http'; import { HttpXsrfTokenExtractor } from '@angular/common/http';
import { CookieService } from '../../core/services/cookie.service'; import { CookieService } from '../../core/services/cookie.service';
import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock'; import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
import { HttpXsrfTokenExtractorMock } from '../../shared/mocks/http-xsrf-token-e xtractor.mock'; import { HttpXsrfTokenExtractorMock } from '../../shared/mocks/http-xsrf-token-e xtractor.mock';
import { getMockEntityTypeService } from './my-dspace-new-submission-dropdown/my
-dspace-new-submission-dropdown.component.spec';
import { EntityTypeService } from '../../core/data/entity-type.service';
describe('MyDSpaceNewSubmissionComponent test', () => { describe('MyDSpaceNewSubmissionComponent test', () => {
const uploader: any = jasmine.createSpyObj('uploader', { const uploader: any = jasmine.createSpyObj('uploader', {
clearQueue: jasmine.createSpy('clearQueue').and.stub(), clearQueue: jasmine.createSpy('clearQueue').and.stub(),
onBuildItemForm: jasmine.createSpy('onBuildItemForm').and.stub(), onBuildItemForm: jasmine.createSpy('onBuildItemForm').and.stub(),
uploadAll: jasmine.createSpy('uploadAll').and.stub() uploadAll: jasmine.createSpy('uploadAll').and.stub()
}); });
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
skipping to change at line 65 skipping to change at line 66
{ provide: HALEndpointService, useValue: new HALEndpointServiceStub('wor kspaceitems') }, { provide: HALEndpointService, useValue: new HALEndpointServiceStub('wor kspaceitems') },
{ provide: NotificationsService, useValue: new NotificationsServiceStub( ) }, { provide: NotificationsService, useValue: new NotificationsServiceStub( ) },
{ provide: ScrollToService, useValue: getMockScrollToService() }, { provide: ScrollToService, useValue: getMockScrollToService() },
NgbModal, NgbModal,
ChangeDetectorRef, ChangeDetectorRef,
MyDSpaceNewSubmissionComponent, MyDSpaceNewSubmissionComponent,
UploaderService, UploaderService,
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorM ock('mock-token') }, { provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorM ock('mock-token') },
{ provide: CookieService, useValue: new CookieServiceMock() }, { provide: CookieService, useValue: new CookieServiceMock() },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) } , { provide: HostWindowService, useValue: new HostWindowServiceStub(800) } ,
{ provide: EntityTypeService, useValue: getMockEntityTypeService() },
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents(); }).compileComponents();
})); }));
describe('', () => { describe('', () => {
let testComp: TestComponent; let testComp: TestComponent;
let testFixture: ComponentFixture<TestComponent>; let testFixture: ComponentFixture<TestComponent>;
// synchronous beforeEach // synchronous beforeEach
skipping to change at line 107 skipping to change at line 109
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(MyDSpaceNewSubmissionComponent); fixture = TestBed.createComponent(MyDSpaceNewSubmissionComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
comp.uploadFilesOptions.authToken = 'user-auth-token'; comp.uploadFilesOptions.authToken = 'user-auth-token';
comp.uploadFilesOptions.url = 'https://fake.upload-api.url'; comp.uploadFilesOptions.url = 'https://fake.upload-api.url';
comp.uploaderComponent = TestBed.createComponent(UploaderComponent).compon entInstance; comp.uploaderComponent = TestBed.createComponent(UploaderComponent).compon entInstance;
comp.uploaderComponent.uploader = uploader; comp.uploaderComponent.uploader = uploader;
}); });
it('should call app.openDialog', (done) => {
spyOn(comp, 'openDialog');
const submissionButton = fixture.debugElement.query(By.css('button.btn-pri
mary'));
submissionButton.triggerEventHandler('click', null);
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(comp.openDialog).toHaveBeenCalled();
done();
});
});
it('should show a collection selector if only one file are uploaded', (done) => { it('should show a collection selector if only one file are uploaded', (done) => {
spyOn((comp as any).modalService, 'open').and.returnValue({ result: new Pr omise((res, rej) => {/****/}) }); spyOn((comp as any).modalService, 'open').and.returnValue({ result: new Pr omise((res, rej) => {/****/}) });
comp.afterFileLoaded(['']); comp.afterFileLoaded(['']);
expect((comp as any).modalService.open).toHaveBeenCalled(); expect((comp as any).modalService.open).toHaveBeenCalled();
done(); done();
}); });
}); });
}); });
// declare a test component // declare a test component
 End of changes. 4 change blocks. 
16 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)