auditLogView.spec.jsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import {Client} from 'sentry/api';
  3. import OrganizationAuditLog from 'sentry/views/settings/organizationAuditLog';
  4. describe('OrganizationAuditLog', function () {
  5. const org = TestStubs.Organization();
  6. const ENDPOINT = `/organizations/${org.slug}/audit-logs/`;
  7. beforeEach(function () {
  8. Client.clearMockResponses();
  9. Client.addMockResponse({
  10. url: ENDPOINT,
  11. body: TestStubs.AuditLogs(),
  12. });
  13. });
  14. it('renders', async function () {
  15. const wrapper = mountWithTheme(
  16. <OrganizationAuditLog location={{query: ''}} params={{orgId: org.slug}} />
  17. );
  18. wrapper.setState({loading: false});
  19. wrapper.update();
  20. await tick();
  21. wrapper.update();
  22. expect(wrapper).toSnapshot();
  23. });
  24. it('displays whether an action was done by a superuser', function () {
  25. const wrapper = mountWithTheme(
  26. <OrganizationAuditLog location={{query: ''}} params={{orgId: org.slug}} />
  27. );
  28. expect(wrapper.find('div[data-test-id="actor-name"]').at(0).text()).toEqual(
  29. expect.stringContaining('(Sentry Staff)')
  30. );
  31. expect(wrapper.find('div[data-test-id="actor-name"]').at(1).text()).toEqual(
  32. expect.not.stringContaining('(Sentry Staff)')
  33. );
  34. });
  35. });