mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Adapt to injectable feature-wrappers
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
19c24b0998
commit
13f1d6f7f3
@ -32,6 +32,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
|
"@k8slens/basic-dependency-features": "^1.0.0-alpha.0",
|
||||||
"@k8slens/react-application": "^1.0.0-alpha.0",
|
"@k8slens/react-application": "^1.0.0-alpha.0",
|
||||||
"@ogre-tools/fp": "^15.3.1",
|
"@ogre-tools/fp": "^15.3.1",
|
||||||
"@ogre-tools/injectable": "^15.3.1",
|
"@ogre-tools/injectable": "^15.3.1",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { getFeature } from "@k8slens/feature-core";
|
import { getFeature } from "@k8slens/feature-core";
|
||||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||||
import { reactApplicationFeature } from "@k8slens/react-application";
|
import { reactApplicationFeature } from "@k8slens/react-application";
|
||||||
|
import { injectableMobXFeature, injectableReactFeature } from "@k8slens/basic-dependency-features";
|
||||||
|
|
||||||
export const keyboardShortcutsFeature = getFeature({
|
export const keyboardShortcutsFeature = getFeature({
|
||||||
id: "keyboard-shortcuts",
|
id: "keyboard-shortcuts",
|
||||||
@ -13,5 +14,5 @@ export const keyboardShortcutsFeature = getFeature({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
dependencies: [reactApplicationFeature],
|
dependencies: [injectableReactFeature, injectableMobXFeature, reactApplicationFeature],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,8 +2,6 @@ import userEvent from "@testing-library/user-event";
|
|||||||
import type { RenderResult } from "@testing-library/react";
|
import type { RenderResult } from "@testing-library/react";
|
||||||
import { render } from "@testing-library/react";
|
import { render } from "@testing-library/react";
|
||||||
import { createContainer, DiContainer, getInjectable } from "@ogre-tools/injectable";
|
import { createContainer, DiContainer, getInjectable } from "@ogre-tools/injectable";
|
||||||
import { registerInjectableReact } from "@ogre-tools/injectable-react";
|
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { keyboardShortcutInjectionToken } from "./keyboard-shortcut-injection-token";
|
import { keyboardShortcutInjectionToken } from "./keyboard-shortcut-injection-token";
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { keyboardShortcutsFeature } from "./feature";
|
import { keyboardShortcutsFeature } from "./feature";
|
||||||
@ -24,9 +22,6 @@ describe("keyboard-shortcuts", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
registerInjectableReact(di);
|
|
||||||
registerMobX(di);
|
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
registerFeature(di, keyboardShortcutsFeature);
|
registerFeature(di, keyboardShortcutsFeature);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -312,6 +312,7 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/application": "^6.5.0-alpha.0",
|
"@k8slens/application": "^6.5.0-alpha.0",
|
||||||
"@k8slens/application-for-electron-main": "^6.5.0-alpha.0",
|
"@k8slens/application-for-electron-main": "^6.5.0-alpha.0",
|
||||||
|
"@k8slens/basic-dependency-features": "^1.0.0-alpha.0",
|
||||||
"@k8slens/cluster-settings": "^6.5.0-alpha.1",
|
"@k8slens/cluster-settings": "^6.5.0-alpha.1",
|
||||||
"@k8slens/dock": "^1.0.0-alpha.0",
|
"@k8slens/dock": "^1.0.0-alpha.0",
|
||||||
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
||||||
|
|||||||
@ -25,9 +25,9 @@ import initializeClusterManagerInjectable from "./cluster/initialize-manager.inj
|
|||||||
import type { GlobalOverride } from "@k8slens/test-utils";
|
import type { GlobalOverride } from "@k8slens/test-utils";
|
||||||
import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes";
|
import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes";
|
||||||
import { setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
import { setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { messagingFeature, testUtils as messagingTestUtils } from "@k8slens/messaging";
|
import { messagingFeature, testUtils as messagingTestUtils } from "@k8slens/messaging";
|
||||||
|
import { injectableMobXFeature } from "@k8slens/basic-dependency-features";
|
||||||
|
|
||||||
export function getDiForUnitTesting() {
|
export function getDiForUnitTesting() {
|
||||||
const environment = "main";
|
const environment = "main";
|
||||||
@ -35,12 +35,15 @@ export function getDiForUnitTesting() {
|
|||||||
detectCycles: false,
|
detectCycles: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
registerMobX(di);
|
|
||||||
setLegacyGlobalDiForExtensionApi(di, environment);
|
setLegacyGlobalDiForExtensionApi(di, environment);
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeature, messagingTestUtils.messagingFeatureForUnitTesting);
|
registerFeature(
|
||||||
|
di,
|
||||||
|
injectableMobXFeature,
|
||||||
|
messagingFeature,
|
||||||
|
messagingTestUtils.messagingFeatureForUnitTesting,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
di.preventSideEffects();
|
di.preventSideEffects();
|
||||||
|
|||||||
@ -15,10 +15,9 @@ import watchHistoryStateInjectable from "./remote-helpers/watch-history-state.in
|
|||||||
import legacyOnChannelListenInjectable from "./ipc/legacy-channel-listen.injectable";
|
import legacyOnChannelListenInjectable from "./ipc/legacy-channel-listen.injectable";
|
||||||
import type { GlobalOverride } from "@k8slens/test-utils";
|
import type { GlobalOverride } from "@k8slens/test-utils";
|
||||||
import { setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
import { setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { registerInjectableReact } from "@ogre-tools/injectable-react";
|
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { messagingFeature, testUtils as messagingTestUtils } from "@k8slens/messaging";
|
import { messagingFeature, testUtils as messagingTestUtils } from "@k8slens/messaging";
|
||||||
|
import { injectableReactFeature, injectableMobXFeature } from "@k8slens/basic-dependency-features";
|
||||||
|
|
||||||
export const getDiForUnitTesting = () => {
|
export const getDiForUnitTesting = () => {
|
||||||
const environment = "renderer";
|
const environment = "renderer";
|
||||||
@ -26,12 +25,16 @@ export const getDiForUnitTesting = () => {
|
|||||||
detectCycles: false,
|
detectCycles: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
registerMobX(di);
|
|
||||||
registerInjectableReact(di);
|
|
||||||
setLegacyGlobalDiForExtensionApi(di, environment);
|
setLegacyGlobalDiForExtensionApi(di, environment);
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeature, messagingTestUtils.messagingFeatureForUnitTesting);
|
registerFeature(
|
||||||
|
di,
|
||||||
|
injectableReactFeature,
|
||||||
|
injectableMobXFeature,
|
||||||
|
messagingFeature,
|
||||||
|
messagingTestUtils.messagingFeatureForUnitTesting
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
di.preventSideEffects();
|
di.preventSideEffects();
|
||||||
|
|||||||
@ -190,6 +190,7 @@
|
|||||||
"@k8slens/core": "^6.5.0-alpha.6",
|
"@k8slens/core": "^6.5.0-alpha.6",
|
||||||
"@k8slens/ensure-binaries": "^6.5.0-alpha.2",
|
"@k8slens/ensure-binaries": "^6.5.0-alpha.2",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.2",
|
"@k8slens/feature-core": "^6.5.0-alpha.2",
|
||||||
|
"@k8slens/basic-dependency-features": "^1.0.0-alpha.0",
|
||||||
"@k8slens/keyboard-shortcuts": "^1.0.0-alpha.2",
|
"@k8slens/keyboard-shortcuts": "^1.0.0-alpha.2",
|
||||||
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
"@k8slens/kubectl-versions": "^1.0.0-alpha.0",
|
||||||
"@k8slens/legacy-extension-example": "^1.0.0-alpha.4",
|
"@k8slens/legacy-extension-example": "^1.0.0-alpha.4",
|
||||||
|
|||||||
@ -6,11 +6,11 @@ import {
|
|||||||
registerLensCore,
|
registerLensCore,
|
||||||
} from "@k8slens/core/main";
|
} from "@k8slens/core/main";
|
||||||
import { createContainer } from "@ogre-tools/injectable";
|
import { createContainer } from "@ogre-tools/injectable";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { applicationFeature, startApplicationInjectionToken } from '@k8slens/application'
|
import { applicationFeature, startApplicationInjectionToken } from '@k8slens/application'
|
||||||
import { applicationFeatureForElectronMain } from '@k8slens/application-for-electron-main'
|
import { applicationFeatureForElectronMain } from '@k8slens/application-for-electron-main'
|
||||||
import { messagingFeatureForMain } from "@k8slens/messaging-for-main";
|
import { messagingFeatureForMain } from "@k8slens/messaging-for-main";
|
||||||
|
import { injectableMobXFeature } from "@k8slens/basic-dependency-features";
|
||||||
|
|
||||||
const environment = "main";
|
const environment = "main";
|
||||||
|
|
||||||
@ -18,12 +18,16 @@ const di = createContainer(environment, {
|
|||||||
detectCycles: false,
|
detectCycles: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
registerMobX(di);
|
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
registerLensCore(di, environment);
|
registerLensCore(di, environment);
|
||||||
|
|
||||||
registerFeature(di, applicationFeature, applicationFeatureForElectronMain, messagingFeatureForMain);
|
registerFeature(
|
||||||
|
di,
|
||||||
|
injectableMobXFeature,
|
||||||
|
applicationFeature,
|
||||||
|
applicationFeatureForElectronMain,
|
||||||
|
messagingFeatureForMain
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
autoRegister({
|
autoRegister({
|
||||||
|
|||||||
@ -13,12 +13,11 @@ import {
|
|||||||
startApplicationInjectionToken,
|
startApplicationInjectionToken,
|
||||||
} from "@k8slens/application";
|
} from "@k8slens/application";
|
||||||
import { createContainer } from "@ogre-tools/injectable";
|
import { createContainer } from "@ogre-tools/injectable";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { registerInjectableReact } from "@ogre-tools/injectable-react";
|
|
||||||
import { messagingFeatureForRenderer } from "@k8slens/messaging-for-renderer";
|
import { messagingFeatureForRenderer } from "@k8slens/messaging-for-renderer";
|
||||||
import { keyboardShortcutsFeature } from "@k8slens/keyboard-shortcuts";
|
import { keyboardShortcutsFeature } from "@k8slens/keyboard-shortcuts";
|
||||||
import { reactApplicationFeature } from "@k8slens/react-application";
|
import { reactApplicationFeature } from "@k8slens/react-application";
|
||||||
import { dockFeature } from "@k8slens/dock";
|
import { dockFeature } from "@k8slens/dock";
|
||||||
|
import { injectableReactFeature, injectableMobXFeature } from "@k8slens/basic-dependency-features";
|
||||||
|
|
||||||
const environment = "renderer";
|
const environment = "renderer";
|
||||||
|
|
||||||
@ -27,12 +26,12 @@ const di = createContainer(environment, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
registerMobX(di);
|
|
||||||
registerInjectableReact(di);
|
|
||||||
registerLensCore(di, environment);
|
registerLensCore(di, environment);
|
||||||
|
|
||||||
registerFeature(
|
registerFeature(
|
||||||
di,
|
di,
|
||||||
|
injectableReactFeature,
|
||||||
|
injectableMobXFeature,
|
||||||
applicationFeature,
|
applicationFeature,
|
||||||
messagingFeatureForRenderer,
|
messagingFeatureForRenderer,
|
||||||
keyboardShortcutsFeature,
|
keyboardShortcutsFeature,
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/application": "^6.5.0-alpha.0",
|
"@k8slens/application": "^6.5.0-alpha.0",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
|
"@k8slens/basic-dependency-features": "^1.0.0-alpha.0",
|
||||||
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
"@k8slens/startable-stoppable": "^1.0.0-alpha.1",
|
||||||
"@ogre-tools/injectable": "^15.3.1",
|
"@ogre-tools/injectable": "^15.3.1",
|
||||||
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
"@ogre-tools/injectable-extension-for-auto-registration": "^15.3.0",
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||||
import { applicationFeature } from "@k8slens/application";
|
import { applicationFeature } from "@k8slens/application";
|
||||||
import { getFeature } from "@k8slens/feature-core";
|
import { getFeature } from "@k8slens/feature-core";
|
||||||
|
import { injectableMobXFeature } from "@k8slens/basic-dependency-features";
|
||||||
|
|
||||||
export const messagingFeature = getFeature({
|
export const messagingFeature = getFeature({
|
||||||
id: "messaging",
|
id: "messaging",
|
||||||
|
|
||||||
dependencies: [applicationFeature],
|
dependencies: [injectableMobXFeature, applicationFeature],
|
||||||
|
|
||||||
register: (di) => {
|
register: (di) => {
|
||||||
autoRegister({
|
autoRegister({
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { createContainer, DiContainer, Injectable } from "@ogre-tools/injectable";
|
import { createContainer, DiContainer, Injectable } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { runInAction } from "mobx";
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -31,8 +30,6 @@ describe("listening-of-messages", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
registerMobX(di);
|
|
||||||
|
|
||||||
disposeSomeListenerMock = jest.fn();
|
disposeSomeListenerMock = jest.fn();
|
||||||
disposeSomeUnrelatedListenerMock = jest.fn();
|
disposeSomeUnrelatedListenerMock = jest.fn();
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { createContainer, DiContainer, Injectable } from "@ogre-tools/injectable";
|
import { createContainer, DiContainer, Injectable } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { _resetGlobalState, configure, runInAction } from "mobx";
|
import { _resetGlobalState, configure, runInAction } from "mobx";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -37,8 +36,6 @@ describe("listening-of-requests", () => {
|
|||||||
|
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
registerMobX(di);
|
|
||||||
|
|
||||||
disposeSomeListenerMock = jest.fn();
|
disposeSomeListenerMock = jest.fn();
|
||||||
disposeSomeUnrelatedListenerMock = jest.fn();
|
disposeSomeUnrelatedListenerMock = jest.fn();
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import { startApplicationInjectionToken } from "@k8slens/application";
|
|||||||
import { computed, IComputedValue, IObservableValue, observable, reaction, runInAction } from "mobx";
|
import { computed, IComputedValue, IObservableValue, observable, reaction, runInAction } from "mobx";
|
||||||
import type { MessageChannel } from "@k8slens/messaging";
|
import type { MessageChannel } from "@k8slens/messaging";
|
||||||
import { getMessageChannelListenerInjectable } from "@k8slens/messaging";
|
import { getMessageChannelListenerInjectable } from "@k8slens/messaging";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { testUtils } from "@k8slens/messaging";
|
import { testUtils } from "@k8slens/messaging";
|
||||||
import { computedChannelInjectionToken, computedChannelObserverInjectionToken } from "./computed-channel.injectable";
|
import { computedChannelInjectionToken, computedChannelObserverInjectionToken } from "./computed-channel.injectable";
|
||||||
@ -40,8 +39,6 @@ const TestComponent = observer(({ someComputed }: { someComputed: IComputedValue
|
|||||||
|
|
||||||
di1 = createContainer("some-container-1");
|
di1 = createContainer("some-container-1");
|
||||||
di2 = createContainer("some-container-2");
|
di2 = createContainer("some-container-2");
|
||||||
registerMobX(di1);
|
|
||||||
registerMobX(di2);
|
|
||||||
|
|
||||||
const administrationChannelTestListenerInjectable = getMessageChannelListenerInjectable({
|
const administrationChannelTestListenerInjectable = getMessageChannelListenerInjectable({
|
||||||
id: "administration-channel-test-listener",
|
id: "administration-channel-test-listener",
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { EnlistMessageChannelListener, enlistMessageChannelListenerInjectionToke
|
|||||||
import { createContainer } from "@ogre-tools/injectable";
|
import { createContainer } from "@ogre-tools/injectable";
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { messagingFeatureForMain } from "../feature";
|
import { messagingFeatureForMain } from "../feature";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("enlist message channel listener in main", () => {
|
describe("enlist message channel listener in main", () => {
|
||||||
let enlistMessageChannelListener: EnlistMessageChannelListener;
|
let enlistMessageChannelListener: EnlistMessageChannelListener;
|
||||||
@ -14,7 +15,9 @@ describe("enlist message channel listener in main", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const di = createContainer("irrelevant");
|
const di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForMain);
|
registerFeature(di, messagingFeatureForMain);
|
||||||
|
});
|
||||||
|
|
||||||
onMock = jest.fn();
|
onMock = jest.fn();
|
||||||
offMock = jest.fn();
|
offMock = jest.fn();
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { getPromiseStatus } from "@k8slens/test-utils";
|
|||||||
import { createContainer } from "@ogre-tools/injectable";
|
import { createContainer } from "@ogre-tools/injectable";
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { messagingFeatureForMain } from "../feature";
|
import { messagingFeatureForMain } from "../feature";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
type TestRequestChannel = RequestChannel<unknown, unknown>;
|
type TestRequestChannel = RequestChannel<unknown, unknown>;
|
||||||
|
|
||||||
@ -25,7 +26,9 @@ describe("enlist request channel listener in main", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const di = createContainer("irrelevant");
|
const di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForMain);
|
registerFeature(di, messagingFeatureForMain);
|
||||||
|
});
|
||||||
|
|
||||||
handleMock = jest.fn();
|
handleMock = jest.fn();
|
||||||
offMock = jest.fn();
|
offMock = jest.fn();
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { registerFeature } from "@k8slens/feature-core";
|
|||||||
import ipcMainInjectable from "./ipc-main.injectable";
|
import ipcMainInjectable from "./ipc-main.injectable";
|
||||||
import { ipcMain } from "electron";
|
import { ipcMain } from "electron";
|
||||||
import { messagingFeatureForMain } from "../feature";
|
import { messagingFeatureForMain } from "../feature";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("ipc-main", () => {
|
describe("ipc-main", () => {
|
||||||
let di: DiContainer;
|
let di: DiContainer;
|
||||||
@ -10,8 +11,10 @@ describe("ipc-main", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForMain);
|
registerFeature(di, messagingFeatureForMain);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("is the actual IPC-main of Electron", () => {
|
it("is the actual IPC-main of Electron", () => {
|
||||||
const actual = di.inject(ipcMainInjectable);
|
const actual = di.inject(ipcMainInjectable);
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { getMessageChannel, sendMessageToChannelInjectionToken } from "@k8slens/
|
|||||||
import getWebContentsInjectable from "./get-web-contents.injectable";
|
import getWebContentsInjectable from "./get-web-contents.injectable";
|
||||||
import type { WebContents } from "electron";
|
import type { WebContents } from "electron";
|
||||||
import allowCommunicationListenerInjectable from "./allow-communication-listener.injectable";
|
import allowCommunicationListenerInjectable from "./allow-communication-listener.injectable";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
const someChannel = getMessageChannel<string>("some-channel");
|
const someChannel = getMessageChannel<string>("some-channel");
|
||||||
|
|
||||||
@ -14,8 +15,10 @@ describe("send-message-to-channel", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForMain);
|
registerFeature(di, messagingFeatureForMain);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("given no web contents, when sending a message, does not do anything", () => {
|
it("given no web contents, when sending a message, does not do anything", () => {
|
||||||
di.override(getWebContentsInjectable, () => () => []);
|
di.override(getWebContentsInjectable, () => () => []);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { createContainer, DiContainer } from "@ogre-tools/injectable";
|
import { createContainer, DiContainer } from "@ogre-tools/injectable";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { startApplicationInjectionToken } from "@k8slens/application";
|
import { startApplicationInjectionToken } from "@k8slens/application";
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { messagingFeatureForRenderer } from "./feature";
|
import { messagingFeatureForRenderer } from "./feature";
|
||||||
@ -15,8 +14,6 @@ describe("allow communication to iframe", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
registerMobX(di);
|
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForRenderer);
|
registerFeature(di, messagingFeatureForRenderer);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { registerFeature } from "@k8slens/feature-core";
|
|||||||
import ipcRendererInjectable from "./ipc-renderer.injectable";
|
import ipcRendererInjectable from "./ipc-renderer.injectable";
|
||||||
import { messagingFeatureForRenderer } from "../feature";
|
import { messagingFeatureForRenderer } from "../feature";
|
||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("ipc-renderer", () => {
|
describe("ipc-renderer", () => {
|
||||||
let di: DiContainer;
|
let di: DiContainer;
|
||||||
@ -10,8 +11,10 @@ describe("ipc-renderer", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForRenderer);
|
registerFeature(di, messagingFeatureForRenderer);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("is not undefined", () => {
|
it("is not undefined", () => {
|
||||||
const actual = di.inject(ipcRendererInjectable);
|
const actual = di.inject(ipcRendererInjectable);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { EnlistMessageChannelListener, enlistMessageChannelListenerInjectionToke
|
|||||||
import { createContainer } from "@ogre-tools/injectable";
|
import { createContainer } from "@ogre-tools/injectable";
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { messagingFeatureForRenderer } from "../feature";
|
import { messagingFeatureForRenderer } from "../feature";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("enlist message channel listener in renderer", () => {
|
describe("enlist message channel listener in renderer", () => {
|
||||||
let enlistMessageChannelListener: EnlistMessageChannelListener;
|
let enlistMessageChannelListener: EnlistMessageChannelListener;
|
||||||
@ -14,7 +15,9 @@ describe("enlist message channel listener in renderer", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const di = createContainer("irrelevant");
|
const di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForRenderer);
|
registerFeature(di, messagingFeatureForRenderer);
|
||||||
|
});
|
||||||
|
|
||||||
onMock = jest.fn();
|
onMock = jest.fn();
|
||||||
offMock = jest.fn();
|
offMock = jest.fn();
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { registerFeature } from "@k8slens/feature-core";
|
|||||||
import { messagingFeatureForRenderer } from "../feature";
|
import { messagingFeatureForRenderer } from "../feature";
|
||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
import invokeIpcInjectable from "./invoke-ipc.injectable";
|
import invokeIpcInjectable from "./invoke-ipc.injectable";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("ipc-renderer", () => {
|
describe("ipc-renderer", () => {
|
||||||
let di: DiContainer;
|
let di: DiContainer;
|
||||||
@ -10,8 +11,10 @@ describe("ipc-renderer", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForRenderer);
|
registerFeature(di, messagingFeatureForRenderer);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("is IPC-renderer invoke of Electron", () => {
|
it("is IPC-renderer invoke of Electron", () => {
|
||||||
const actual = di.inject(invokeIpcInjectable);
|
const actual = di.inject(invokeIpcInjectable);
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import { createContainer, DiContainer } from "@ogre-tools/injectable";
|
import { createContainer, DiContainer } from "@ogre-tools/injectable";
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
|
import type { RequestChannel } from "@k8slens/messaging";
|
||||||
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
|
import { requestFromChannelInjectionToken } from "@k8slens/messaging";
|
||||||
import { messagingFeatureForRenderer } from "../feature";
|
import { messagingFeatureForRenderer } from "../feature";
|
||||||
import type { RequestChannel } from "@k8slens/messaging";
|
|
||||||
import invokeIpcInjectable from "./invoke-ipc.injectable";
|
import invokeIpcInjectable from "./invoke-ipc.injectable";
|
||||||
import type { AsyncFnMock } from "@async-fn/jest";
|
import type { AsyncFnMock } from "@async-fn/jest";
|
||||||
import asyncFn from "@async-fn/jest";
|
import asyncFn from "@async-fn/jest";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("request-from-channel", () => {
|
describe("request-from-channel", () => {
|
||||||
let di: DiContainer;
|
let di: DiContainer;
|
||||||
@ -14,7 +15,9 @@ describe("request-from-channel", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForRenderer);
|
registerFeature(di, messagingFeatureForRenderer);
|
||||||
|
});
|
||||||
|
|
||||||
invokeIpcMock = asyncFn();
|
invokeIpcMock = asyncFn();
|
||||||
di.override(invokeIpcInjectable, () => invokeIpcMock);
|
di.override(invokeIpcInjectable, () => invokeIpcMock);
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import { createContainer, DiContainer } from "@ogre-tools/injectable";
|
import { createContainer, DiContainer } from "@ogre-tools/injectable";
|
||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
|
import type { MessageChannel } from "@k8slens/messaging";
|
||||||
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
|
import { sendMessageToChannelInjectionToken } from "@k8slens/messaging";
|
||||||
import { messagingFeatureForRenderer } from "../feature";
|
import { messagingFeatureForRenderer } from "../feature";
|
||||||
import type { MessageChannel } from "@k8slens/messaging";
|
|
||||||
import sendToIpcInjectable from "./send-to-ipc.injectable";
|
import sendToIpcInjectable from "./send-to-ipc.injectable";
|
||||||
import type { AsyncFnMock } from "@async-fn/jest";
|
import type { AsyncFnMock } from "@async-fn/jest";
|
||||||
import asyncFn from "@async-fn/jest";
|
import asyncFn from "@async-fn/jest";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("message-from-channel", () => {
|
describe("message-from-channel", () => {
|
||||||
let di: DiContainer;
|
let di: DiContainer;
|
||||||
@ -14,7 +15,9 @@ describe("message-from-channel", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForRenderer);
|
registerFeature(di, messagingFeatureForRenderer);
|
||||||
|
});
|
||||||
|
|
||||||
sendToIpcMock = asyncFn();
|
sendToIpcMock = asyncFn();
|
||||||
di.override(sendToIpcInjectable, () => sendToIpcMock);
|
di.override(sendToIpcInjectable, () => sendToIpcMock);
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { registerFeature } from "@k8slens/feature-core";
|
|||||||
import { messagingFeatureForRenderer } from "../feature";
|
import { messagingFeatureForRenderer } from "../feature";
|
||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
import sendToIpcInjectable from "./send-to-ipc.injectable";
|
import sendToIpcInjectable from "./send-to-ipc.injectable";
|
||||||
|
import { runInAction } from "mobx";
|
||||||
|
|
||||||
describe("ipc-renderer", () => {
|
describe("ipc-renderer", () => {
|
||||||
let di: DiContainer;
|
let di: DiContainer;
|
||||||
@ -10,8 +11,10 @@ describe("ipc-renderer", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = createContainer("irrelevant");
|
di = createContainer("irrelevant");
|
||||||
|
|
||||||
|
runInAction(() => {
|
||||||
registerFeature(di, messagingFeatureForRenderer);
|
registerFeature(di, messagingFeatureForRenderer);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("is IPC-renderer send of Electron", () => {
|
it("is IPC-renderer send of Electron", () => {
|
||||||
const actual = di.inject(sendToIpcInjectable);
|
const actual = di.inject(sendToIpcInjectable);
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import {
|
|||||||
sendMessageToChannelInjectionToken,
|
sendMessageToChannelInjectionToken,
|
||||||
} from "@k8slens/messaging";
|
} from "@k8slens/messaging";
|
||||||
|
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { runInAction } from "mobx";
|
import { runInAction } from "mobx";
|
||||||
import { getPromiseStatus } from "@k8slens/test-utils";
|
import { getPromiseStatus } from "@k8slens/test-utils";
|
||||||
import { getMessageBridgeFake } from "./get-message-bridge-fake";
|
import { getMessageBridgeFake } from "./get-message-bridge-fake";
|
||||||
@ -50,10 +49,6 @@ const someRequestChannelWithoutListeners: SomeRequestChannel = {
|
|||||||
|
|
||||||
someDiWithoutListeners = createContainer("some-di-3");
|
someDiWithoutListeners = createContainer("some-di-3");
|
||||||
|
|
||||||
registerMobX(someDi1);
|
|
||||||
registerMobX(someDi2);
|
|
||||||
registerMobX(someDiWithoutListeners);
|
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
const feature = testUtils.messagingFeatureForUnitTesting;
|
const feature = testUtils.messagingFeatureForUnitTesting;
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@k8slens/application": "^6.5.0-alpha.2",
|
"@k8slens/application": "^6.5.0-alpha.2",
|
||||||
|
"@k8slens/basic-dependency-features": "^1.0.0-alpha.0",
|
||||||
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
"@k8slens/feature-core": "^6.5.0-alpha.0",
|
||||||
"@ogre-tools/fp": "^15.3.1",
|
"@ogre-tools/fp": "^15.3.1",
|
||||||
"@ogre-tools/injectable": "^15.3.1",
|
"@ogre-tools/injectable": "^15.3.1",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { getFeature } from "@k8slens/feature-core";
|
import { getFeature } from "@k8slens/feature-core";
|
||||||
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
|
||||||
import { applicationFeature } from "@k8slens/application";
|
import { applicationFeature } from "@k8slens/application";
|
||||||
|
import { injectableMobXFeature, injectableReactFeature } from "@k8slens/basic-dependency-features";
|
||||||
|
|
||||||
export const reactApplicationFeature = getFeature({
|
export const reactApplicationFeature = getFeature({
|
||||||
id: "react-application",
|
id: "react-application",
|
||||||
@ -13,5 +14,5 @@ export const reactApplicationFeature = getFeature({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
dependencies: [applicationFeature],
|
dependencies: [injectableReactFeature, injectableMobXFeature, applicationFeature],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import { registerFeature } from "@k8slens/feature-core";
|
import { registerFeature } from "@k8slens/feature-core";
|
||||||
import { createContainer, DiContainer, getInjectable } from "@ogre-tools/injectable";
|
import { createContainer, DiContainer, getInjectable } from "@ogre-tools/injectable";
|
||||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
|
||||||
import { registerInjectableReact } from "@ogre-tools/injectable-react";
|
|
||||||
import { reactApplicationFeature } from "./feature";
|
import { reactApplicationFeature } from "./feature";
|
||||||
import { runInAction, computed, observable, IObservableValue } from "mobx";
|
import { runInAction, computed, observable, IObservableValue } from "mobx";
|
||||||
import { startApplicationInjectionToken } from "@k8slens/application";
|
import { startApplicationInjectionToken } from "@k8slens/application";
|
||||||
@ -26,10 +24,6 @@ describe("react-application", () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
di = createContainer("some-container");
|
di = createContainer("some-container");
|
||||||
|
|
||||||
registerInjectableReact(di);
|
|
||||||
|
|
||||||
registerMobX(di);
|
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
registerFeature(di, reactApplicationFeature);
|
registerFeature(di, reactApplicationFeature);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user