@beisen/storybook-react
Version:
Storybook for React: Develop React Component in isolation with Hot Reloading.
54 lines (50 loc) • 1.78 kB
JavaScript
;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var preset = _interopRequireWildcard(require("./framework-preset-react-docgen"));
describe('framework-preset-react-docgen', function () {
var babelPluginReactDocgenPath = require.resolve('babel-plugin-react-docgen');
it('should return the config with the extra plugins when `plugins` is an array.', function () {
var babelConfig = {
babelrc: false,
presets: ['env', 'foo-preset'],
plugins: ['foo-plugin']
};
var config = preset.babel(babelConfig);
expect(config).toEqual({
babelrc: false,
plugins: ['foo-plugin', [babelPluginReactDocgenPath, {
DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES'
}]],
presets: ['env', 'foo-preset']
});
});
it('should return the config with the extra plugins when `plugins` is not an array.', function () {
var babelConfig = {
babelrc: false,
presets: ['env', 'foo-preset'],
plugins: 'bar-plugin'
};
var config = preset.babel(babelConfig);
expect(config).toEqual({
babelrc: false,
plugins: ['bar-plugin', [babelPluginReactDocgenPath, {
DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES'
}]],
presets: ['env', 'foo-preset']
});
});
it('should return the config only with the extra plugins when `plugins` is not present.', function () {
var babelConfig = {
babelrc: false,
presets: ['env', 'foo-preset']
};
var config = preset.babel(babelConfig);
expect(config).toEqual({
babelrc: false,
plugins: [[babelPluginReactDocgenPath, {
DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES'
}]],
presets: ['env', 'foo-preset']
});
});
});