sentryProjectSelectorField.spec.jsx 727 B

123456789101112131415161718192021222324
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import {selectByValue} from 'sentry-test/select-new';
  3. import SentryProjectSelectorField from 'sentry/components/forms/sentryProjectSelectorField';
  4. describe('SentryProjectSelectorField', () => {
  5. it('can change values', () => {
  6. const mock = jest.fn();
  7. const projects = [
  8. TestStubs.Project(),
  9. TestStubs.Project({
  10. id: '23',
  11. slug: 'my-proj',
  12. name: 'My Proj',
  13. }),
  14. ];
  15. const wrapper = mountWithTheme(
  16. <SentryProjectSelectorField onChange={mock} name="project" projects={projects} />
  17. );
  18. selectByValue(wrapper, '23', {control: true});
  19. expect(mock).toHaveBeenCalledWith('23', expect.anything());
  20. });
  21. });