mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix failing unit tests about overriding too late (#7287)
The fix was to defer injection. The error was made possible in master by git-merging a PR which was falsely green. Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
c6799e1478
commit
d3c9c6b5f6
@ -21,17 +21,7 @@ import logErrorInjectable from "../../../common/log-error.injectable";
|
||||
const telemetryDecoratorInjectable = getInjectable({
|
||||
id: "telemetry-decorator",
|
||||
|
||||
instantiate: (diForDecorator) => {
|
||||
const emitTelemetry = diForDecorator.inject(emitTelemetryInjectable);
|
||||
const logError = diForDecorator.inject(logErrorInjectable);
|
||||
|
||||
const whiteList = diForDecorator.inject(
|
||||
telemetryWhiteListForFunctionsInjectable,
|
||||
);
|
||||
|
||||
const whiteListMap = getWhiteListMap(whiteList);
|
||||
|
||||
return {
|
||||
instantiate: (diForDecorator) => ({
|
||||
decorate:
|
||||
(instantiateToBeDecorated: any) =>
|
||||
(di: DiContainerForInjection, instantiationParameter: any) => {
|
||||
@ -43,10 +33,20 @@ const telemetryDecoratorInjectable = getInjectable({
|
||||
|
||||
assert(currentContext);
|
||||
|
||||
const whiteListed = whiteListMap.get(
|
||||
currentContext.injectable.id,
|
||||
const emitTelemetry = diForDecorator.inject(
|
||||
emitTelemetryInjectable,
|
||||
);
|
||||
|
||||
const logError = diForDecorator.inject(logErrorInjectable);
|
||||
|
||||
const whiteList = diForDecorator.inject(
|
||||
telemetryWhiteListForFunctionsInjectable,
|
||||
);
|
||||
|
||||
const whiteListMap = getWhiteListMap(whiteList);
|
||||
|
||||
const whiteListed = whiteListMap.get(currentContext.injectable.id);
|
||||
|
||||
if (whiteListed) {
|
||||
let params;
|
||||
|
||||
@ -76,8 +76,7 @@ const telemetryDecoratorInjectable = getInjectable({
|
||||
|
||||
return instance;
|
||||
},
|
||||
};
|
||||
},
|
||||
}),
|
||||
|
||||
decorable: false,
|
||||
// Todo: this is required because of imperfect typing in injectable.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user