mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Introduce helper to get a global override for a function-injectable
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
97e04632ca
commit
6e155953d9
13
src/common/test-utils/get-global-override-for-function.ts
Normal file
13
src/common/test-utils/get-global-override-for-function.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { Injectable } from "@ogre-tools/injectable";
|
||||
import { getGlobalOverride } from "./get-global-override";
|
||||
|
||||
export const getGlobalOverrideForFunction = (
|
||||
injectable: Injectable<Function, any, any>,
|
||||
) =>
|
||||
getGlobalOverride(injectable, () => () => {
|
||||
throw new Error(`Tried to invoke a function "${injectable.id}" without override`);
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user