mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
parent
a38196699e
commit
3497a5da79
2 changed files with 4 additions and 3 deletions
|
@ -145,8 +145,9 @@ export type CustomRequestHandlerMock<T> = {
|
|||
[Key in keyof T]: T[Key] extends Promise<unknown> ? T[Key] : Promise<T[Key]>;
|
||||
};
|
||||
|
||||
const createCustomRequestHandlerContextMock = <T>(contextParts: T): CustomRequestHandlerMock<T> => {
|
||||
// @ts-expect-error upgrade typescript v4.9.5
|
||||
const createCustomRequestHandlerContextMock = <T extends Record<string, unknown>>(
|
||||
contextParts: T
|
||||
): CustomRequestHandlerMock<T> => {
|
||||
const mock = Object.entries(contextParts).reduce(
|
||||
(context, [key, value]) => {
|
||||
// @ts-expect-error type matching from inferred types is hard
|
||||
|
|
|
@ -28,7 +28,7 @@ export const createMockClients = () => {
|
|||
|
||||
type MockClients = ReturnType<typeof createMockClients>;
|
||||
|
||||
const convertRequestContextMock = <T>(context: T) => {
|
||||
const convertRequestContextMock = <T extends Record<string, unknown>>(context: T) => {
|
||||
return coreMock.createCustomRequestHandlerContext(context);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue