withConfig.spec.jsx 609 B

1234567891011121314151617
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import ConfigStore from 'app/stores/configStore';
  3. import withConfig from 'app/utils/withConfig';
  4. describe('withConfig HoC', function () {
  5. it('adds config prop', async function () {
  6. ConfigStore.init();
  7. const MyComponent = () => null;
  8. const Container = withConfig(MyComponent);
  9. const wrapper = mountWithTheme(<Container />);
  10. expect(wrapper.find('MyComponent').prop('config')).toEqual({});
  11. ConfigStore.set('user', 'foo');
  12. wrapper.update();
  13. expect(wrapper.find('MyComponent').prop('config')).toEqual({user: 'foo'});
  14. });
  15. });