mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove global shared state to fix unit tests (#5889)
This commit is contained in:
1 parent
bedc440d42
commit
f61330611e
28 files changed
+44
-56
No files matched your search
+5
-7
@@ -3,8 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { SemVer } from "semver";
|
||||
import appVersionInjectable from "../../get-configuration-file-model/app-version/app-version.injectable";
|
||||
import appSemanticVersionInjectable from "../../vars/app-semantic-version.injectable";
|
||||
import type { UpdateChannelId } from "../update-channels";
|
||||
import { updateChannels } from "../update-channels";
|
||||
|
||||
@@ -12,12 +11,11 @@ const defaultUpdateChannelInjectable = getInjectable({
|
||||
id: "default-update-channel",
|
||||
|
||||
instantiate: (di) => {
|
||||
const appVersion = di.inject(appVersionInjectable);
|
||||
const appSemanticVersion = di.inject(appSemanticVersionInjectable);
|
||||
const currentReleaseChannel = appSemanticVersion.prerelease[0]?.toString();
|
||||
|
||||
const currentReleaseChannel = new SemVer(appVersion).prerelease[0]?.toString() as UpdateChannelId;
|
||||
|
||||
if (currentReleaseChannel && updateChannels[currentReleaseChannel]) {
|
||||
return updateChannels[currentReleaseChannel];
|
||||
if (currentReleaseChannel in updateChannels) {
|
||||
return updateChannels[currentReleaseChannel as UpdateChannelId];
|
||||
}
|
||||
|
||||
return updateChannels.latest;
|
||||
|
||||
Reference in new issue
Block a user