refactor(web): remove unused desktop update visibility helper (#10014)
This commit is contained in:
1 parent
270e021f2a
commit
93d4dfa206
2 files changed
+1
-18
No files matched your search
@@ -12,7 +12,6 @@ import {
|
||||
isDesktopUpdateButtonDisabled,
|
||||
resolveDesktopUpdateButtonAction,
|
||||
shouldShowArm64IntelBuildWarning,
|
||||
shouldShowDesktopUpdateButton,
|
||||
shouldToastDesktopUpdateActionResult,
|
||||
} from "./desktopUpdate.logic";
|
||||
|
||||
@@ -42,7 +41,6 @@ describe("desktop update button state", () => {
|
||||
status: "available",
|
||||
availableVersion: "1.1.0",
|
||||
};
|
||||
expect(shouldShowDesktopUpdateButton(state)).toBe(true);
|
||||
expect(resolveDesktopUpdateButtonAction(state)).toBe("download");
|
||||
});
|
||||
|
||||
@@ -55,7 +53,6 @@ describe("desktop update button state", () => {
|
||||
errorContext: "download",
|
||||
canRetry: true,
|
||||
};
|
||||
expect(shouldShowDesktopUpdateButton(state)).toBe(true);
|
||||
expect(resolveDesktopUpdateButtonAction(state)).toBe("download");
|
||||
expect(getDesktopUpdateButtonTooltip(state)).toContain("Click to retry");
|
||||
});
|
||||
@@ -70,7 +67,6 @@ describe("desktop update button state", () => {
|
||||
errorContext: "install",
|
||||
canRetry: true,
|
||||
};
|
||||
expect(shouldShowDesktopUpdateButton(state)).toBe(true);
|
||||
expect(resolveDesktopUpdateButtonAction(state)).toBe("install");
|
||||
expect(getDesktopUpdateButtonTooltip(state)).toContain("Click to retry");
|
||||
});
|
||||
@@ -85,7 +81,6 @@ describe("desktop update button state", () => {
|
||||
errorContext: null,
|
||||
canRetry: true,
|
||||
};
|
||||
expect(shouldShowDesktopUpdateButton(state)).toBe(true);
|
||||
expect(resolveDesktopUpdateButtonAction(state)).toBe("install");
|
||||
expect(getDesktopUpdateButtonTooltip(state)).toContain("Click to restart and install");
|
||||
});
|
||||
@@ -111,7 +106,7 @@ describe("desktop update button state", () => {
|
||||
expect(resolveDesktopUpdateButtonAction(state)).toBe("none");
|
||||
});
|
||||
|
||||
it("hides the button for non-actionable check errors", () => {
|
||||
it("has no action for non-actionable check errors", () => {
|
||||
const state: DesktopUpdateState = {
|
||||
...baseState,
|
||||
status: "error",
|
||||
@@ -119,7 +114,6 @@ describe("desktop update button state", () => {
|
||||
errorContext: "check",
|
||||
canRetry: true,
|
||||
};
|
||||
expect(shouldShowDesktopUpdateButton(state)).toBe(false);
|
||||
expect(resolveDesktopUpdateButtonAction(state)).toBe("none");
|
||||
});
|
||||
|
||||
@@ -130,7 +124,6 @@ describe("desktop update button state", () => {
|
||||
availableVersion: "1.1.0",
|
||||
downloadPercent: 42.5,
|
||||
};
|
||||
expect(shouldShowDesktopUpdateButton(state)).toBe(true);
|
||||
expect(isDesktopUpdateButtonDisabled(state)).toBe(true);
|
||||
expect(getDesktopUpdateButtonTooltip(state)).toContain("42%");
|
||||
});
|
||||
|
||||
@@ -47,16 +47,6 @@ export function resolveDesktopUpdateButtonAction(
|
||||
return "none";
|
||||
}
|
||||
|
||||
export function shouldShowDesktopUpdateButton(state: DesktopUpdateState | null): boolean {
|
||||
if (!state || !state.enabled) {
|
||||
return false;
|
||||
}
|
||||
if (state.status === "downloading") {
|
||||
return true;
|
||||
}
|
||||
return resolveDesktopUpdateButtonAction(state) !== "none";
|
||||
}
|
||||
|
||||
export function shouldShowArm64IntelBuildWarning(state: DesktopUpdateState | null): boolean {
|
||||
return state?.hostArch === "arm64" && state.appArch === "x64";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user