UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

29 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var enzyme_1 = require("enzyme"); var _1 = require("./"); var index_1 = require("../../index"); var storyConfigFixture = { metadata: { displayName: 'Component', props: {} }, config: {}, }; describe('importExample view', function () { it('should pass trimmed and ticked source to markdown', function () { var source = "\n\"hello\"\n "; var assertion = "```js\n\"hello\"\n```"; var rendered = (0, enzyme_1.mount)((0, _1.importExample)((0, index_1.importExample)({ source: source }), storyConfigFixture)); expect(rendered.find('Markdown').prop('source')).toEqual(assertion); }); describe('given no arguments', function () { it('should construct importExample from StoryConfig', function () { var assertion = "```js\nimport Component from 'library/Component';\n```"; var rendered = (0, enzyme_1.mount)((0, _1.importExample)((0, index_1.importExample)(), tslib_1.__assign(tslib_1.__assign({}, storyConfigFixture), { config: { importFormat: "import %componentName from '%moduleName/%componentName';", moduleName: 'library', } }))); expect(rendered.find('Markdown').prop('source')).toEqual(assertion); }); }); }); //# sourceMappingURL=index.test.js.map