editRulesModal.spec.tsx 1.5 KB

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