withConfig.spec.jsx 620 B

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