Add unit tests for SectionsService#isSectionType

This commit is contained in:
Yura Bondarenko
2021-07-02 18:12:18 +02:00
parent 7670ba8a43
commit 8736c0b572

View File

@@ -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', () => {
it('should dispatch a new EnableSectionAction a move target to new section', () => {