insomnia/packages/insomnia-app/app/test-utils.ts
Opender Singh be2c347cf1
Pull a project into the correct space (#3873)
* use selector and improve types

* Loading remote projects now requires a team id; it is no longer optional

* activate with workspace or workspace id

* extract helper

* normalize graphql return type for a remote project to include the team

* pull into the space as defined by the project team id, not by the active space. If the space doesn't exist, create it

* use helper

* make testing easier by putting the active space name as the first breadcrumb

* fix tests

* add the active space into the title

* refactor and add tests

* remove todo
2021-08-05 23:30:31 +00:00

30 lines
996 B
TypeScript

import { showAlert, showError, showModal, showPrompt } from './ui/components/modals';
export const getAndClearShowPromptMockArgs = () => {
const mockFn = showPrompt as jest.Mock<typeof showPrompt, Parameters<typeof showPrompt>>;
const options = mockFn.mock.calls[0][0];
mockFn.mockClear();
return options;
};
export const getAndClearShowAlertMockArgs = () => {
const mockFn = showAlert as jest.Mock<typeof showAlert, Parameters<typeof showAlert>>;
const options = mockFn.mock.calls[0][0];
mockFn.mockClear();
return options;
};
export const getAndClearShowErrorMockArgs = () => {
const mockFn = showError as jest.Mock<typeof showError, Parameters<typeof showError>>;
const options = mockFn.mock.calls[0][0];
mockFn.mockClear();
return options;
};
export const getAndClearShowModalMockArgs = () => {
const mockFn = showModal as jest.Mock<typeof showModal, Parameters<typeof showModal>>;
const args = mockFn.mock.calls[0][1];
mockFn.mockClear();
return args;
};