mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Switch to using release channel of installed application version as default value for selected update channel
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
4 files changed
+126
-25
No files matched your search
+4
-4
@@ -1,6 +1,6 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`installing update from update channels when started renders 1`] = `
|
||||
exports[`installing update from update channels given no update channel selection is stored, when started renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
@@ -10,7 +10,7 @@ exports[`installing update from update channels when started renders 1`] = `
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update from update channels when started when user checks for updates renders 1`] = `
|
||||
exports[`installing update from update channels given no update channel selection is stored, when started when user checks for updates renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
@@ -20,7 +20,7 @@ exports[`installing update from update channels when started when user checks fo
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update from update channels when started when user checks for updates when new update is discovered renders 1`] = `
|
||||
exports[`installing update from update channels given no update channel selection is stored, when started when user checks for updates when new update is discovered renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
@@ -30,7 +30,7 @@ exports[`installing update from update channels when started when user checks fo
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update from update channels when started when user checks for updates when new update is discovered when download succeeds renders 1`] = `
|
||||
exports[`installing update from update channels given no update channel selection is stored, when started when user checks for updates when new update is discovered when download succeeds renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
|
||||
@@ -23,6 +23,8 @@ import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable";
|
||||
import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable";
|
||||
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
|
||||
import checkForUpdatesInjectable from "../../main/update-app/check-for-updates/check-for-updates.injectable";
|
||||
import appVersionInjectable
|
||||
from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
||||
|
||||
describe("installing update from update channels", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
@@ -69,7 +71,7 @@ describe("installing update from update channels", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("when started", () => {
|
||||
describe("given no update channel selection is stored, when started", () => {
|
||||
let rendered: RenderResult;
|
||||
let checkForUpdates: () => Promise<void>;
|
||||
|
||||
@@ -299,4 +301,88 @@ describe("installing update from update channels", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("given valid update channel selection is stored, when checking for updates, checks for updates from the update channel", async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
// TODO: Switch to more natural way of setting initial value
|
||||
// TODO: UserStore is currently responsible for getting and setting initial value
|
||||
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
|
||||
|
||||
selectedUpdateChannel.setValue(updateChannels.beta.id);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
||||
|
||||
checkForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||
});
|
||||
|
||||
it("given invalid update channel selection is stored, when checking for updates, checks for updates from the update channel", async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
// TODO: Switch to more natural way of setting initial value
|
||||
// TODO: UserStore is currently responsible for getting and setting initial value
|
||||
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
|
||||
|
||||
selectedUpdateChannel.setValue("something-invalid" as UpdateChannelId);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
||||
|
||||
checkForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.latest, expect.any(Object));
|
||||
});
|
||||
|
||||
it('given no update channel selection is stored and currently using alpha release, when checking for updates, checks for updates from "alpha" channel', async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
||||
|
||||
checkForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.alpha, expect.any(Object));
|
||||
});
|
||||
|
||||
it('given no update channel selection is stored and currently using beta release, when checking for updates, checks for updates from "beta" channel', async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(appVersionInjectable, () => "1.0.0-beta");
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
||||
|
||||
checkForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||
});
|
||||
|
||||
it("given update channel selection is stored and currently using prerelease, when checking for updates, checks for updates from stored channel", async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
|
||||
|
||||
// TODO: Switch to more natural way of setting initial value
|
||||
// TODO: UserStore is currently responsible for getting and setting initial value
|
||||
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
|
||||
|
||||
selectedUpdateChannel.setValue(updateChannels.beta.id);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const checkForUpdates = applicationBuilder.dis.mainDi.inject(checkForUpdatesInjectable);
|
||||
|
||||
checkForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user