Skip to content

Commit a9f0179

Browse files
update api.factory.test.js : add test for
_getPreSiblingTabId and _getNextSiblingTabId
1 parent d85ab8b commit a9f0179

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/utils/api/api.factory.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,23 @@ describe('Api.prototype._getPreSelectedTabId : ', () => {
528528
expect(obj._getPreSelectedTabId()).toBe('tab2');
529529
});
530530
});
531+
describe('Api.prototype._getPreSiblingTabId : ', () => {
532+
test('it should call helper.filterArrayUntilFirstValue with appropriate parameters', () => {
533+
obj.helper.filterArrayUntilFirstValue = jest.fn(() => {});
534+
obj.stateRef = {selectedTabID: '2', openTabIDs: ['1', '2', '3']};
535+
obj._getPreSiblingTabId();
536+
expect(obj.helper.filterArrayUntilFirstValue.mock.calls.length).toBe(1);
537+
expect(obj.helper.filterArrayUntilFirstValue.mock.calls[0][0]).toEqual(['1']);
538+
expect(obj.helper.filterArrayUntilFirstValue.mock.calls[0][2]).toBe(true);
539+
});
540+
});
541+
describe('Api.prototype._getNextSiblingTabId : ', () => {
542+
test('it should call helper.filterArrayUntilFirstValue with appropriate parameters', () => {
543+
obj.helper.filterArrayUntilFirstValue = jest.fn(() => {});
544+
obj.stateRef = {selectedTabID: '2', openTabIDs: ['1', '2', '3']};
545+
obj._getNextSiblingTabId();
546+
expect(obj.helper.filterArrayUntilFirstValue.mock.calls.length).toBe(1);
547+
expect(obj.helper.filterArrayUntilFirstValue.mock.calls[0][0]).toEqual(['3']);
548+
expect(!obj.helper.filterArrayUntilFirstValue.mock.calls[0][2]).toBe(true);
549+
});
550+
});

0 commit comments

Comments
 (0)