accountSecuritySessionHistory.spec.jsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import SessionHistory from 'sentry/views/settings/account/accountSecurity/sessionHistory';
  3. const ENDPOINT = '/users/me/ips/';
  4. describe('AccountSecuritySessionHistory', function () {
  5. afterEach(function () {
  6. MockApiClient.clearMockResponses();
  7. });
  8. it('renders an ip address', function () {
  9. MockApiClient.addMockResponse({
  10. url: ENDPOINT,
  11. body: [
  12. {
  13. countryCode: null,
  14. regionCode: null,
  15. lastSeen: '2018-09-07T18:24:29.401Z',
  16. ipAddress: '127.0.0.1',
  17. id: '1',
  18. firstSeen: '2018-09-07T17:59:14.642Z',
  19. },
  20. {
  21. countryCode: 'US',
  22. regionCode: 'CA',
  23. lastSeen: '2018-09-07T18:17:05.087Z',
  24. ipAddress: '192.168.0.1',
  25. id: '3',
  26. firstSeen: '2018-09-07T18:17:05.087Z',
  27. },
  28. ],
  29. });
  30. render(<SessionHistory />, {context: TestStubs.routerContext()});
  31. expect(screen.getByText('127.0.0.1')).toBeInTheDocument();
  32. expect(screen.getByText('192.168.0.1')).toBeInTheDocument();
  33. expect(screen.getByText('US (CA)')).toBeInTheDocument();
  34. });
  35. });