editRulesModal.spec.tsx 1.8 KB

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