UNPKG

wix-style-react

Version:
30 lines (27 loc) 1.76 kB
import breadcrumbsPathFactory from './BreadcrumbsPathFactory'; describe('BreadcrumbsPathFactory', function () { it('should create an options from a url', function () { var url = 'aaa/bbb/ccc'; var options = [{ id: 0, value: 'aaa', link: '/aaa' }, { id: 1, value: 'bbb', link: '/aaa/bbb' }, { id: 2, value: 'ccc', link: '/aaa/bbb/ccc' }]; expect(breadcrumbsPathFactory(url)).toEqual(options); }); it('should create an options from a url with baseUrl include', function () { var url = 'aaa/bbb/ccc'; var baseUrlLink = 'https://www.wix.com'; var baseUrlValue = 'wix'; var options = [{ id: 0, value: 'wix', link: 'https://www.wix.com' }, { id: 1, value: 'aaa', link: 'https://www.wix.com/aaa' }, { id: 2, value: 'bbb', link: 'https://www.wix.com/aaa/bbb' }, { id: 3, value: 'ccc', link: 'https://www.wix.com/aaa/bbb/ccc' }]; expect(breadcrumbsPathFactory(url, baseUrlLink, baseUrlValue)).toEqual(options); }); it('should create an options from a url with baseUrl not include', function () { var url = 'aaa/bbb/ccc'; var baseUrlLink = 'https://www.wix.com'; var options = [{ id: 0, value: 'aaa', link: 'https://www.wix.com/aaa' }, { id: 1, value: 'bbb', link: 'https://www.wix.com/aaa/bbb' }, { id: 2, value: 'ccc', link: 'https://www.wix.com/aaa/bbb/ccc' }]; expect(breadcrumbsPathFactory(url, baseUrlLink)).toEqual(options); }); it('should create an options from a url with a custom separator', function () { var url = 'aaa-bbb-ccc'; var separator = '-'; var options = [{ id: 0, value: 'aaa', link: '/aaa' }, { id: 1, value: 'bbb', link: '/aaa/bbb' }, { id: 2, value: 'ccc', link: '/aaa/bbb/ccc' }]; expect(breadcrumbsPathFactory(url, '', null, separator)).toEqual(options); }); });