withConfig.spec.jsx 584 B

1234567891011121314151617181920212223
  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. function MyComponent({config}) {
  10. return <div>{config.test}</div>;
  11. }
  12. const Container = withConfig(MyComponent);
  13. render(<Container />);
  14. act(() => void ConfigStore.set('test', 'foo'));
  15. expect(screen.getByText('foo')).toBeInTheDocument();
  16. });
  17. });