wix-style-react
Version:
wix-style-react
36 lines (30 loc) • 1.25 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import queryString from 'query-string';
import { getStoryUrl, createStoryUrl as originalCreateStoryUrl } from 'wix-ui-test-utils/protractor';
import { TESTS_PREFIX, RTL_QUERY_PARAM_NAME } from '../../stories/storiesHierarchy';
/** @deprecated use createStoryUrl */
export { getStoryUrl };
export var createStoryUrl = function createStoryUrl(_ref) {
var kind = _ref.kind,
story = _ref.story,
withExamples = _ref.withExamples,
rtl = _ref.rtl;
var baseUrl = originalCreateStoryUrl({
kind: kind,
story: story,
withExamples: withExamples
});
var params = queryString.stringify(_defineProperty({}, RTL_QUERY_PARAM_NAME, rtl));
return params ? baseUrl + '&' + params : baseUrl;
};
export var createTestStoryUrl = function createTestStoryUrl(_ref2) {
var testName = _ref2.testName,
category = _ref2.category,
storyName = _ref2.storyName,
rtl = _ref2.rtl;
return createStoryUrl({
kind: TESTS_PREFIX + '/' + category + '/' + storyName,
story: testName,
rtl: rtl
});
};