1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Adapt existing code and tests to presence of telemetry

Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
Iku-turso 2022-09-02 09:21:53 +03:00
parent 7e9e48e631
commit 7ddaa7544d
9 changed files with 19 additions and 8 deletions

View File

@ -0,0 +1,8 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getGlobalOverride } from "../test-utils/get-global-override";
import emitEventInjectable from "./emit-event.injectable";
export default getGlobalOverride(emitEventInjectable, () => () => {});

View File

@ -9,6 +9,7 @@ const appEventBusInjectable = getInjectable({
id: "app-event-bus",
instantiate: () => appEventBus,
causesSideEffects: true,
decorable: false,
});
export default appEventBusInjectable;

View File

@ -12,7 +12,7 @@ describe("kubernetesClusterCategory", () => {
let kubernetesClusterCategory: KubernetesClusterCategory;
beforeEach(() => {
const di = getDiForUnitTesting();
const di = getDiForUnitTesting({ doGeneralOverrides: true });
kubernetesClusterCategory = di.inject(kubernetesClusterCategoryInjectable);
});

View File

@ -19,7 +19,7 @@ describe("with-error-logging", () => {
let decorated: (a: string, b: string) => number | undefined;
beforeEach(() => {
const di = getDiForUnitTesting();
const di = getDiForUnitTesting({ doGeneralOverrides: true });
loggerStub = {
error: jest.fn(),
@ -119,7 +119,7 @@ describe("with-error-logging", () => {
let toBeDecorated: AsyncFnMock<typeof decorated>;
beforeEach(() => {
const di = getDiForUnitTesting();
const di = getDiForUnitTesting({ doGeneralOverrides: true });
loggerStub = {
error: jest.fn(),

View File

@ -19,6 +19,7 @@ import quitAndInstallUpdateInjectable from "../../main/application-update/quit-a
import appVersionInjectable from "../../common/vars/app-version.injectable";
import periodicalCheckForUpdatesInjectable from "../../main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable";
import { advanceFakeTime, useFakeTime } from "../../common/test-utils/use-fake-time";
import emitEventInjectable from "../../common/app-event-bus/emit-event.injectable";
describe("analytics for installing update", () => {
let builder: ApplicationBuilder;
@ -51,6 +52,8 @@ describe("analytics for installing update", () => {
mainDi.override(publishIsConfiguredInjectable, () => true);
mainDi.unoverride(emitEventInjectable);
const eventBus = mainDi.inject(appEventBusInjectable);
eventBus.addListener(analyticsListenerMock);
@ -65,7 +68,6 @@ describe("analytics for installing update", () => {
mainDi.permitSideEffects(periodicalCheckForUpdatesInjectable);
await builder.render();
});
it("sends event to analytics for being checked periodically", () => {

View File

@ -20,7 +20,7 @@ describe("technical: resolve-system-proxy-from-electron", () => {
let actualPromise: Promise<string>;
beforeEach(() => {
di = getDiForUnitTesting();
di = getDiForUnitTesting({ doGeneralOverrides: true });
logErrorMock = jest.fn();
di.override(logErrorInjectable, () => logErrorMock);

View File

@ -80,7 +80,7 @@ describe("CatalogEntityRegistry", () => {
let catalogCategoryRegistry: CatalogCategoryRegistry;
beforeEach(() => {
const di = getDiForUnitTesting();
const di = getDiForUnitTesting({ doGeneralOverrides: true });
entityRegistry = di.inject(catalogEntityRegistryInjectable);
catalogCategoryRegistry = di.inject(catalogCategoryRegistryInjectable);

View File

@ -43,7 +43,7 @@ describe("Custom Category Columns", () => {
let di: DiContainer;
beforeEach(() => {
di = getDiForUnitTesting();
di = getDiForUnitTesting({ doGeneralOverrides: true });
di.override(hotbarStoreInjectable, () => ({}));
});

View File

@ -16,7 +16,7 @@ describe("Custom Category Views", () => {
let di: DiContainer;
beforeEach(() => {
di = getDiForUnitTesting();
di = getDiForUnitTesting({ doGeneralOverrides: true });
});
it("should order items correctly over all extensions", () => {