diff --git a/addons/info/src/index.test.js b/addons/info/src/index.test.js index b828d441b24..68c2d371d8f 100644 --- a/addons/info/src/index.test.js +++ b/addons/info/src/index.test.js @@ -2,22 +2,56 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import AddonInfo, { withInfo } from './'; +import AddonInfo, { withInfo, setDefaults, addInfo } from './'; + +/* eslint-disable */ +const TestComponent = ({ func, obj, array, number, string, bool, empty }) => +
+

{func}

+

{obj.toString()}

+

{array}

+

{number}

+
{string}
+
{bool}
+

{empty}

+ test + storiesOf + +
  • 1
  • +
  • 2
  • +
    +
    ; +/* eslint-enable */ + +const testContext = { kind: 'addon_info', story: 'jest_test' }; +const testOptions = { propTables: false }; describe('addon Info', () => { const story = context =>
    - It's a {context.story} story + It's a {context.story} story: + x + 1} + obj={{ a: 'a', b: 'b' }} + array={[1, 2, 3]} + number={7} + string={'seven'} + bool + />
    ; const api = { - add: (name, fn) => fn({ kind: 'addon_info', story: 'jest_test' }), + add: (name, fn) => fn(testContext), }; it('should render ', () => { const Info = withInfo('Test Info')(story); ReactDOM.render(, document.createElement('div')); }); + it('should should render with missed info', () => { + setDefaults(testOptions); + addInfo(null, testContext, { info: story, options: testOptions }); + }); it('should show deprecation warning', () => { const addWithInfo = AddonInfo.addWithInfo.bind(api); - addWithInfo('jest', 'test info', story); + addWithInfo('jest', story); }); });