mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-27 16:49:51 -07:00
feat(sync-ui): sync window renderer, snapshots in /tmp/subminer-db-snapshots, docs + changelog
This commit is contained in:
@@ -119,3 +119,29 @@ test('runSyncLauncher surfaces spawn errors', async () => {
|
||||
assert.equal(result.ok, false);
|
||||
assert.match(result.error ?? '', /ENOENT/);
|
||||
});
|
||||
|
||||
test('resolveSyncLauncherCommand prefers the bundled launcher over PATH', async () => {
|
||||
const { resolveSyncLauncherCommand } = await import('./sync-launcher-client');
|
||||
const bundled = resolveSyncLauncherCommand({
|
||||
findCommand: (name: string) =>
|
||||
name === 'bun' ? '/usr/bin/bun' : name === 'subminer' ? '/home/u/.local/bin/subminer' : null,
|
||||
resolveResourcePath: () => '/opt/app/resources/launcher/subminer',
|
||||
existsSync: () => true,
|
||||
});
|
||||
assert.deepEqual(bundled.command, ['/usr/bin/bun', '/opt/app/resources/launcher/subminer']);
|
||||
|
||||
const fallback = resolveSyncLauncherCommand({
|
||||
findCommand: (name: string) => (name === 'subminer' ? '/home/u/.local/bin/subminer' : null),
|
||||
resolveResourcePath: () => '/missing',
|
||||
existsSync: () => false,
|
||||
});
|
||||
assert.deepEqual(fallback.command, ['/home/u/.local/bin/subminer']);
|
||||
|
||||
const none = resolveSyncLauncherCommand({
|
||||
findCommand: () => null,
|
||||
resolveResourcePath: () => '/missing',
|
||||
existsSync: () => false,
|
||||
});
|
||||
assert.equal(none.command, null);
|
||||
assert.match(none.error ?? '', /launcher/i);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user