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({
|
const telemetryDecoratorInjectable = getInjectable({
|
||||||
id: "telemetry-decorator",
|
id: "telemetry-decorator",
|
||||||
|
|
||||||
instantiate: (diForDecorator) => {
|
instantiate: (diForDecorator) => ({
|
||||||
const emitTelemetry = diForDecorator.inject(emitTelemetryInjectable);
|
|
||||||
const logError = diForDecorator.inject(logErrorInjectable);
|
|
||||||
|
|
||||||
const whiteList = diForDecorator.inject(
|
|
||||||
telemetryWhiteListForFunctionsInjectable,
|
|
||||||
);
|
|
||||||
|
|
||||||
const whiteListMap = getWhiteListMap(whiteList);
|
|
||||||
|
|
||||||
return {
|
|
||||||
decorate:
|
decorate:
|
||||||
(instantiateToBeDecorated: any) =>
|
(instantiateToBeDecorated: any) =>
|
||||||
(di: DiContainerForInjection, instantiationParameter: any) => {
|
(di: DiContainerForInjection, instantiationParameter: any) => {
|
||||||
@ -43,10 +33,20 @@ const telemetryDecoratorInjectable = getInjectable({
|
|||||||
|
|
||||||
assert(currentContext);
|
assert(currentContext);
|
||||||
|
|
||||||
const whiteListed = whiteListMap.get(
|
const emitTelemetry = diForDecorator.inject(
|
||||||
currentContext.injectable.id,
|
emitTelemetryInjectable,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const logError = diForDecorator.inject(logErrorInjectable);
|
||||||
|
|
||||||
|
const whiteList = diForDecorator.inject(
|
||||||
|
telemetryWhiteListForFunctionsInjectable,
|
||||||
|
);
|
||||||
|
|
||||||
|
const whiteListMap = getWhiteListMap(whiteList);
|
||||||
|
|
||||||
|
const whiteListed = whiteListMap.get(currentContext.injectable.id);
|
||||||
|
|
||||||
if (whiteListed) {
|
if (whiteListed) {
|
||||||
let params;
|
let params;
|
||||||
|
|
||||||
@ -76,8 +76,7 @@ const telemetryDecoratorInjectable = getInjectable({
|
|||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
},
|
},
|
||||||
};
|
}),
|
||||||
},
|
|
||||||
|
|
||||||
decorable: false,
|
decorable: false,
|
||||||
// Todo: this is required because of imperfect typing in injectable.
|
// Todo: this is required because of imperfect typing in injectable.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user