editRulesModal.spec.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import {Members} from 'sentry-fixture/members';
  2. import {Organization} from 'sentry-fixture/organization';
  3. import {render, screen} from 'sentry-test/reactTestingLibrary';
  4. import ConfigStore from 'sentry/stores/configStore';
  5. import {IssueOwnership} from 'sentry/types';
  6. import {EditOwnershipRules} from './editRulesModal';
  7. describe('Project Ownership Input', () => {
  8. const org = Organization();
  9. const project = TestStubs.Project();
  10. const user = TestStubs.User();
  11. beforeEach(() => {
  12. ConfigStore.set('user', user);
  13. MockApiClient.addMockResponse({
  14. url: `/organizations/${org.slug}/members/`,
  15. method: 'GET',
  16. body: Members(),
  17. });
  18. });
  19. const ownership: IssueOwnership = {
  20. fallthrough: false,
  21. autoAssignment: 'Auto Assign to Suspect Commits',
  22. codeownersAutoSync: false,
  23. raw: 'url:src',
  24. isActive: true,
  25. dateCreated: '',
  26. lastUpdated: '',
  27. };
  28. afterEach(() => {
  29. MockApiClient.clearMockResponses();
  30. });
  31. it('renders', () => {
  32. render(
  33. <EditOwnershipRules
  34. organization={org}
  35. ownership={ownership}
  36. project={project}
  37. onCancel={() => {}}
  38. onSave={() => {}}
  39. />
  40. );
  41. expect(screen.getByText('Globbing Syntax')).toBeInTheDocument();
  42. });
  43. it('renders with streamline-targeting-context', () => {
  44. render(
  45. <EditOwnershipRules
  46. organization={{...org, features: ['streamline-targeting-context']}}
  47. ownership={ownership}
  48. project={project}
  49. onCancel={() => {}}
  50. onSave={() => {}}
  51. />
  52. );
  53. expect(screen.getByText(/Assign issues based on custom rules/)).toBeInTheDocument();
  54. });
  55. });