wix-style-react
Version:
wix-style-react
36 lines (30 loc) • 2.02 kB
JavaScript
;
var _BreadcrumbsPathFactory = require('./BreadcrumbsPathFactory');
var _BreadcrumbsPathFactory2 = _interopRequireDefault(_BreadcrumbsPathFactory);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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((0, _BreadcrumbsPathFactory2.default)(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((0, _BreadcrumbsPathFactory2.default)(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((0, _BreadcrumbsPathFactory2.default)(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((0, _BreadcrumbsPathFactory2.default)(url, '', null, separator)).toEqual(options);
});
});