fix(updater): handle unsupported macOS app updates

This commit is contained in:
2026-05-16 02:05:28 -07:00
parent d05e2bd8ec
commit 89723e2ccb
8 changed files with 112 additions and 18 deletions
+28 -1
View File
@@ -1,6 +1,10 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { createUpdateDialogPresenter, type ShowMessageBox } from './update-dialogs';
import {
createUpdateDialogPresenter,
showManualUpdateRequiredDialog,
type ShowMessageBox,
} from './update-dialogs';
test('update dialog presenter focuses app before showing macOS dialogs', async () => {
const calls: string[] = [];
@@ -35,3 +39,26 @@ test('update dialog presenter does not focus app before showing non-macOS dialog
assert.deepEqual(calls, ['dialog:SubMiner is up to date (v0.14.0)']);
});
test('manual update required dialog explains that automatic install is unavailable', async () => {
let shown:
| {
type?: string;
title?: string;
message: string;
detail?: string;
buttons?: string[];
}
| undefined;
const showMessageBox: ShowMessageBox = async (options) => {
shown = options;
return { response: 0 };
};
await showManualUpdateRequiredDialog(showMessageBox, '0.15.0-beta.1');
assert.equal(shown?.type, 'warning');
assert.equal(shown?.message, 'Manual install required');
assert.match(shown?.detail ?? '', /SubMiner v0\.15\.0-beta\.1 is available/);
assert.match(shown?.detail ?? '', /cannot install app updates automatically/);
});