editRulesModal.spec.tsx 1.6 KB

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