withConfig.spec.jsx 566 B

123456789101112131415161718192021
  1. import {act, render, screen} from 'sentry-test/reactTestingLibrary';
  2. import ConfigStore from 'sentry/stores/configStore';
  3. import withConfig from 'sentry/utils/withConfig';
  4. describe('withConfig HoC', function () {
  5. beforeEach(() => {
  6. ConfigStore.init();
  7. });
  8. it('adds config prop', function () {
  9. const MyComponent = ({config}) => <div>{config.test}</div>;
  10. const Container = withConfig(MyComponent);
  11. render(<Container />);
  12. act(() => void ConfigStore.set('test', 'foo'));
  13. expect(screen.getByText('foo')).toBeInTheDocument();
  14. });
  15. });