UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

50 lines 1.71 kB
import React from 'react'; import { mount } from 'enzyme'; import { deepAssign } from '../../../../test/utils/deep-assign'; import AutoExample from '../../../AutoExample'; import { playground as playgroundBuilder } from '../../index'; import { playground } from '.'; var testkit = function () { var component; var storyConfigMock = { metadata: { displayName: 'test', props: {}, }, config: { importFormat: '', moduleName: '', repoBaseURL: '', }, component: {}, }; return { when: { created: function (section, config) { if (config === void 0) { config = {}; } component = mount(playground(section, deepAssign(storyConfigMock, config))); return component; }, }, get: { autoExample: function () { return component.find(AutoExample); }, }, }; }; describe('playground section view', function () { describe('given metadata with deprecated props', function () { it('should not pass them to AutoExample', function () { var section = playgroundBuilder({}); var driver = testkit(); driver.when.created(section, { component: function () { return React.createElement("div", null); }, metadata: { props: { deprecated: { tags: [{ title: 'deprecated' }] } }, }, }); var props = driver.get.autoExample().prop('parsedSource').props; expect(props.deprecated).toEqual(undefined); }); }); }); //# sourceMappingURL=index.test.js.map