MockAdapter: add types

settings-alert
Alex Gleason 2022-06-21 13:14:45 -05:00
rodzic 504693db83
commit 145c6efa4e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -7,7 +7,7 @@ import type { AxiosInstance, AxiosResponse } from 'axios';
const api = jest.requireActual('../api') as Record<string, Function>;
let mocks: Array<Function> = [];
export const __stub = (func: Function) => mocks.push(func);
export const __stub = (func: (mock: MockAdapter) => void) => mocks.push(func);
export const __clear = (): Function[] => mocks = [];
const setupMock = (axios: AxiosInstance) => {

Wyświetl plik

@ -13,6 +13,8 @@ import * as BuildConfig from 'soapbox/build_config';
import { RootState } from 'soapbox/store';
import { getAccessToken, getAppToken, isURL, parseBaseURL } from 'soapbox/utils/auth';
import type MockAdapter from 'axios-mock-adapter';
/**
Parse Link headers, mostly for pagination.
@see {@link https://www.npmjs.com/package/http-link-header}
@ -90,3 +92,7 @@ export default (getState: () => RootState, authType: string = 'user'): AxiosInst
return baseClient(accessToken, baseURL);
};
// The Jest mock exports these, so they're needed for TypeScript.
export const __stub = (_func: (mock: MockAdapter) => void) => 0;
export const __clear = (): Function[] => [];