withConfig.spec.jsx 576 B

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