mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
[CSTPER-66] removed detectChanges in single tests, removed TranslateService stub provision, added _links section in community objects
This commit is contained in:
@@ -46,7 +46,8 @@ describe('CreateComColPageComponent', () => {
|
|||||||
metadata: [{
|
metadata: [{
|
||||||
key: 'dc.title',
|
key: 'dc.title',
|
||||||
value: 'test community'
|
value: 'test community'
|
||||||
}]
|
}],
|
||||||
|
_links: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
parentCommunity = Object.assign(new Community(), {
|
parentCommunity = Object.assign(new Community(), {
|
||||||
@@ -55,7 +56,8 @@ describe('CreateComColPageComponent', () => {
|
|||||||
metadata: [{
|
metadata: [{
|
||||||
key: 'dc.title',
|
key: 'dc.title',
|
||||||
value: 'parent community'
|
value: 'parent community'
|
||||||
}]
|
}],
|
||||||
|
_links: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
newCommunity = Object.assign(new Community(), {
|
newCommunity = Object.assign(new Community(), {
|
||||||
@@ -63,7 +65,8 @@ describe('CreateComColPageComponent', () => {
|
|||||||
metadata: [{
|
metadata: [{
|
||||||
key: 'dc.title',
|
key: 'dc.title',
|
||||||
value: 'new community'
|
value: 'new community'
|
||||||
}]
|
}],
|
||||||
|
_links: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
communityDataServiceStub = {
|
communityDataServiceStub = {
|
||||||
@@ -102,7 +105,6 @@ describe('CreateComColPageComponent', () => {
|
|||||||
{ provide: RouteService, useValue: routeServiceStub },
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
{ provide: Router, useValue: routerStub },
|
{ provide: Router, useValue: routerStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: TranslateService, useValue: {}},
|
|
||||||
{ provide: RequestService, useValue: requestServiceStub}
|
{ provide: RequestService, useValue: requestServiceStub}
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -151,7 +153,6 @@ describe('CreateComColPageComponent', () => {
|
|||||||
spyOn((comp as any), 'refreshCache')
|
spyOn((comp as any), 'refreshCache')
|
||||||
scheduler.schedule(() => comp.onSubmit(data));
|
scheduler.schedule(() => comp.onSubmit(data));
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
fixture.detectChanges();
|
|
||||||
expect(router.navigate).toHaveBeenCalled();
|
expect(router.navigate).toHaveBeenCalled();
|
||||||
expect((comp as any).refreshCache).toHaveBeenCalled();
|
expect((comp as any).refreshCache).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -162,7 +163,6 @@ describe('CreateComColPageComponent', () => {
|
|||||||
spyOn((comp as any), 'refreshCache')
|
spyOn((comp as any), 'refreshCache')
|
||||||
scheduler.schedule(() => comp.onSubmit(data));
|
scheduler.schedule(() => comp.onSubmit(data));
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
fixture.detectChanges();
|
|
||||||
expect(router.navigate).not.toHaveBeenCalled();
|
expect(router.navigate).not.toHaveBeenCalled();
|
||||||
expect((comp as any).refreshCache).not.toHaveBeenCalled();
|
expect((comp as any).refreshCache).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -196,14 +196,12 @@ describe('CreateComColPageComponent', () => {
|
|||||||
spyOn(router, 'navigate');
|
spyOn(router, 'navigate');
|
||||||
scheduler.schedule(() => comp.onSubmit(data));
|
scheduler.schedule(() => comp.onSubmit(data));
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
fixture.detectChanges();
|
|
||||||
expect(router.navigate).not.toHaveBeenCalled();
|
expect(router.navigate).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set the uploader\'s url to the logo\'s endpoint', () => {
|
it('should set the uploader\'s url to the logo\'s endpoint', () => {
|
||||||
scheduler.schedule(() => comp.onSubmit(data));
|
scheduler.schedule(() => comp.onSubmit(data));
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
fixture.detectChanges();
|
|
||||||
expect(data.uploader.options.url).toEqual(logoEndpoint);
|
expect(data.uploader.options.url).toEqual(logoEndpoint);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -211,7 +209,6 @@ describe('CreateComColPageComponent', () => {
|
|||||||
spyOn(data.uploader, 'uploadAll');
|
spyOn(data.uploader, 'uploadAll');
|
||||||
scheduler.schedule(() => comp.onSubmit(data));
|
scheduler.schedule(() => comp.onSubmit(data));
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
fixture.detectChanges();
|
|
||||||
expect(data.uploader.uploadAll).toHaveBeenCalled();
|
expect(data.uploader.uploadAll).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user