editRulesModal.spec.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/group';
  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(/Assign issues based on custom rules/)).toBeInTheDocument();
  44. });
  45. });