mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-06-17 03:13:30 -07:00
refactor(main): split main.ts into focused runtime modules (#123)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { showLogExportErrorDialog, showLogExportSuccessDialog } from './log-export-dialogs';
|
||||
|
||||
test('showLogExportSuccessDialog handles dialog rejection', async () => {
|
||||
const warnings: string[] = [];
|
||||
|
||||
await showLogExportSuccessDialog({
|
||||
zipPath: '/tmp/subminer-logs.zip',
|
||||
showMessageBox: async () => {
|
||||
throw new Error('dialog failed');
|
||||
},
|
||||
showItemInFolder: () => {
|
||||
throw new Error('unexpected shell call');
|
||||
},
|
||||
logWarn: (message) => warnings.push(message),
|
||||
});
|
||||
|
||||
assert.deepEqual(warnings, ['Failed to show log export success dialog.']);
|
||||
});
|
||||
|
||||
test('showLogExportErrorDialog handles dialog rejection', async () => {
|
||||
const warnings: string[] = [];
|
||||
|
||||
await showLogExportErrorDialog({
|
||||
message: 'export failed',
|
||||
showMessageBox: async () => {
|
||||
throw new Error('dialog failed');
|
||||
},
|
||||
logWarn: (message) => warnings.push(message),
|
||||
});
|
||||
|
||||
assert.deepEqual(warnings, ['Failed to show log export error dialog.']);
|
||||
});
|
||||
Reference in New Issue
Block a user