mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Add unit tests for SectionsService#isSectionType
This commit is contained in:
@@ -334,6 +334,38 @@ describe('SectionsService test suite', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isSectionType', () => {
|
||||||
|
it('should return true if the section matches the provided type', () => {
|
||||||
|
store.select.and.returnValue(observableOf(submissionState));
|
||||||
|
|
||||||
|
const expected = cold('(b|)', {
|
||||||
|
b: true
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(service.isSectionType(submissionId, 'upload', SectionsType.Upload)).toBeObservable(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if the section doesn\'t match the provided type', () => {
|
||||||
|
store.select.and.returnValue(observableOf(submissionState));
|
||||||
|
|
||||||
|
const expected = cold('(b|)', {
|
||||||
|
b: false
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(service.isSectionType(submissionId, sectionId, SectionsType.Upload)).toBeObservable(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if the provided sectionId doesn\'t exist', () => {
|
||||||
|
store.select.and.returnValue(observableOf(submissionState));
|
||||||
|
|
||||||
|
const expected = cold('(b|)', {
|
||||||
|
b: false
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(service.isSectionType(submissionId, 'no-such-id', SectionsType.Upload)).toBeObservable(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('addSection', () => {
|
describe('addSection', () => {
|
||||||
it('should dispatch a new EnableSectionAction a move target to new section', () => {
|
it('should dispatch a new EnableSectionAction a move target to new section', () => {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user