account.spec.tsx 560 B

12345678910111213141516171819
  1. import {waitFor} from 'sentry-test/reactTestingLibrary';
  2. import {logout} from './account';
  3. describe('logout', () => {
  4. it('has can logout', async function () {
  5. jest.spyOn(window.location, 'assign').mockImplementation(() => {});
  6. const mockApi = new MockApiClient();
  7. const mockApiDelete = MockApiClient.addMockResponse({
  8. url: '/auth/',
  9. method: 'DELETE',
  10. });
  11. logout(mockApi);
  12. await waitFor(() => expect(mockApiDelete).toHaveBeenCalled());
  13. expect(window.location.assign).toHaveBeenCalledWith('/auth/login/');
  14. });
  15. });