Change typing for after/before window/application start (#7342)

- Now the callback is provided with an object containing either
  `mainDi` or `windowDi` fields. This should help with confusion
  over which environment the `di` is for

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2023-03-13 15:35:33 +02:00
1 parent b99b06980e
commit a63f737adb
62 files changed
+185 -189

No files matched your search

@@ -35,7 +35,7 @@ describe("analytics for installing update", () => {
analyticsListenerMock = jest.fn();
builder.beforeApplicationStart(mainDi => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(getBuildVersionInjectable, () => () => "42.0.0");
checkForPlatformUpdatesMock = asyncFn();
@@ -33,7 +33,7 @@ describe("encourage user to update when sufficient time passed since update was
applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart((mainDi) => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();
@@ -24,7 +24,7 @@ describe("installing update using tray", () => {
beforeEach(() => {
builder = getApplicationBuilder();
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();
@@ -35,7 +35,7 @@ describe("force user to update when too long since update was downloaded", () =>
applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(mainDi => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
checkForPlatformUpdatesMock = asyncFn();
mainDi.override(checkForPlatformUpdatesInjectable, () => checkForPlatformUpdatesMock);
@@ -49,7 +49,7 @@ describe("force user to update when too long since update was downloaded", () =>
mainDi.override(quitAndInstallUpdateInjectable, () => quitAndInstallUpdateMock);
});
applicationBuilder.beforeWindowStart(windowDi => {
applicationBuilder.beforeWindowStart(({ windowDi }) => {
windowDi.unoverride(forceUpdateModalRootFrameComponentInjectable);
windowDi.permitSideEffects(forceUpdateModalRootFrameComponentInjectable);
@@ -22,7 +22,7 @@ describe("periodical checking of updates", () => {
builder = getApplicationBuilder();
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.unoverride(periodicalCheckForUpdatesInjectable);
mainDi.permitSideEffects(periodicalCheckForUpdatesInjectable);
@@ -39,7 +39,7 @@ describe("periodical checking of updates", () => {
let rendered: RenderResult;
beforeEach(async () => {
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
mainDi.override(publishIsConfiguredInjectable, () => true);
});
@@ -74,7 +74,7 @@ describe("periodical checking of updates", () => {
describe("given updater is enabled but no configuration exist, when started", () => {
beforeEach(async () => {
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
mainDi.override(publishIsConfiguredInjectable, () => false);
});
@@ -95,7 +95,7 @@ describe("periodical checking of updates", () => {
describe("given updater is not enabled but and configuration exist, when started", () => {
beforeEach(async () => {
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(electronUpdaterIsActiveInjectable, () => false);
mainDi.override(publishIsConfiguredInjectable, () => true);
});
@@ -37,7 +37,7 @@ describe("selection of update stability", () => {
beforeEach(() => {
builder = getApplicationBuilder();
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
quitAndInstallUpdateMock = jest.fn();
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();
@@ -64,7 +64,7 @@ describe("selection of update stability", () => {
mainDi.override(publishIsConfiguredInjectable, () => true);
});
builder.beforeWindowStart((windowDi) => {
builder.beforeWindowStart(({ windowDi }) => {
showInfoNotificationMock = jest.fn(() => () => {});
windowDi.override(showInfoNotificationInjectable, () => showInfoNotificationMock);
@@ -260,7 +260,7 @@ describe("selection of update stability", () => {
});
it('given no update channel selection is stored and currently using stable release, when user checks for updates, checks for updates from "latest" update channel by default', async () => {
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(getBuildVersionInjectable, () => () => "1.0.0");
});
@@ -277,7 +277,7 @@ describe("selection of update stability", () => {
});
it('given no update channel selection is stored and currently using alpha release, when checking for updates, checks for updates from "alpha" channel', async () => {
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(getBuildVersionInjectable, () => () => "1.0.0-alpha");
});
@@ -291,7 +291,7 @@ describe("selection of update stability", () => {
});
it('given no update channel selection is stored and currently using beta release, when checking for updates, checks for updates from "beta" channel', async () => {
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
mainDi.override(getBuildVersionInjectable, () => () => "1.0.0-beta");
});
@@ -24,7 +24,7 @@ describe("downgrading version update", () => {
beforeEach(() => {
applicationBuilder = getApplicationBuilder();
applicationBuilder.beforeApplicationStart(mainDi => {
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
checkForPlatformUpdatesMock = asyncFn();
mainDi.override(
@@ -32,7 +32,7 @@ describe("installing update", () => {
builder = getApplicationBuilder();
builder.beforeApplicationStart((mainDi) => {
builder.beforeApplicationStart(({ mainDi }) => {
electronQuitAndInstallUpdateMock = jest.fn();
checkForPlatformUpdatesMock = asyncFn();
downloadPlatformUpdateMock = asyncFn();