mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix tests by converting BuildSemanticVersion and DefaultUpdateChannel to LazyInitializableState
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
ef631815d5
commit
439f3bf5c7
@ -6,7 +6,7 @@
|
|||||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||||
import { SemVer } from "semver";
|
import { SemVer } from "semver";
|
||||||
import type { InitializableState } from "../initializable-state/create";
|
import type { InitializableState } from "../initializable-state/create";
|
||||||
import { createInitializableState } from "../initializable-state/create";
|
import { createLazyInitializableState } from "../initializable-state/create-lazy";
|
||||||
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
|
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
|
||||||
|
|
||||||
export const buildVersionInjectionToken = getInjectionToken<InitializableState<string>>({
|
export const buildVersionInjectionToken = getInjectionToken<InitializableState<string>>({
|
||||||
@ -17,7 +17,7 @@ export const buildVersionChannel: RequestChannel<void, string> = {
|
|||||||
id: "build-version",
|
id: "build-version",
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildSemanticVersionInjectable = createInitializableState({
|
const buildSemanticVersionInjectable = createLazyInitializableState({
|
||||||
id: "build-semantic-version",
|
id: "build-semantic-version",
|
||||||
init: (di) => {
|
init: (di) => {
|
||||||
const buildVersion = di.inject(buildVersionInjectionToken);
|
const buildVersion = di.inject(buildVersionInjectionToken);
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
import { createLazyInitializableState } from "../../../../common/initializable-state/create-lazy";
|
||||||
import releaseChannelInjectable from "../../../../common/vars/release-channel.injectable";
|
import releaseChannelInjectable from "../../../../common/vars/release-channel.injectable";
|
||||||
import { updateChannels } from "../update-channels";
|
import { updateChannels } from "../update-channels";
|
||||||
import { createInitializableState } from "../../../../common/initializable-state/create";
|
|
||||||
|
|
||||||
const defaultUpdateChannelInjectable = createInitializableState({
|
const defaultUpdateChannelInjectable = createLazyInitializableState({
|
||||||
id: "default-update-channel",
|
id: "default-update-channel",
|
||||||
init: (di) => updateChannels[di.inject(releaseChannelInjectable).get()],
|
init: (di) => updateChannels[di.inject(releaseChannelInjectable).get()],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
|
||||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
|
||||||
import initReleaseChannelInjectable from "../release-channel/init.injectable";
|
|
||||||
import defaultUpdateChannelInjectable from "../../../features/application-update/common/selected-update-channel/default-update-channel.injectable";
|
|
||||||
|
|
||||||
const initDefaultUpdateChannelInjectable = getInjectable({
|
|
||||||
id: "init-default-update-channel",
|
|
||||||
instantiate: (di) => {
|
|
||||||
const defaultUpdateChannel = di.inject(defaultUpdateChannelInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: "init-default-update-channel",
|
|
||||||
run: () => defaultUpdateChannel.init(),
|
|
||||||
runAfter: di.inject(initReleaseChannelInjectable),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default initDefaultUpdateChannelInjectable;
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
|
||||||
import buildSemanticVersionInjectable from "../../../common/vars/build-semantic-version.injectable";
|
|
||||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
|
||||||
import initializeBuildVersionInjectable from "../build-version/init.injectable";
|
|
||||||
|
|
||||||
const initSemanticBuildVersionInjectable = getInjectable({
|
|
||||||
id: "init-semantic-build-version",
|
|
||||||
instantiate: (di) => {
|
|
||||||
const buildSemanticVersion = di.inject(buildSemanticVersionInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: "init-semantic-build-version",
|
|
||||||
run: () => buildSemanticVersion.init(),
|
|
||||||
runAfter: di.inject(initializeBuildVersionInjectable),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default initSemanticBuildVersionInjectable;
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
|
||||||
import { beforeFrameStartsInjectionToken } from "../../before-frame-starts/before-frame-starts-injection-token";
|
|
||||||
import initReleaseChannelInjectable from "../release-channel/init.injectable";
|
|
||||||
import defaultUpdateChannelInjectable from "../../../features/application-update/common/selected-update-channel/default-update-channel.injectable";
|
|
||||||
|
|
||||||
const initDefaultUpdateChannelInjectable = getInjectable({
|
|
||||||
id: "init-default-update-channel",
|
|
||||||
instantiate: (di) => {
|
|
||||||
const defaultUpdateChannel = di.inject(defaultUpdateChannelInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: "init-default-update-channel",
|
|
||||||
run: () => defaultUpdateChannel.init(),
|
|
||||||
runAfter: di.inject(initReleaseChannelInjectable),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
injectionToken: beforeFrameStartsInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default initDefaultUpdateChannelInjectable;
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
||||||
*/
|
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
|
||||||
import buildSemanticVersionInjectable from "../../../common/vars/build-semantic-version.injectable";
|
|
||||||
import { beforeFrameStartsInjectionToken } from "../../before-frame-starts/before-frame-starts-injection-token";
|
|
||||||
import initializeBuildVersionInjectable from "../build-version/init.injectable";
|
|
||||||
|
|
||||||
const initSemanticBuildVersionInjectable = getInjectable({
|
|
||||||
id: "init-semantic-build-version",
|
|
||||||
instantiate: (di) => {
|
|
||||||
const buildSemanticVersion = di.inject(buildSemanticVersionInjectable);
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: "init-semantic-build-version",
|
|
||||||
run: () => buildSemanticVersion.init(),
|
|
||||||
runAfter: di.inject(initializeBuildVersionInjectable),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
injectionToken: beforeFrameStartsInjectionToken,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default initSemanticBuildVersionInjectable;
|
|
||||||
Loading…
Reference in New Issue
Block a user