mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-27 18:12:05 -07:00
Prepare Windows release and signing process (#16)
This commit is contained in:
@@ -21,6 +21,8 @@ function makeArgs(overrides: Partial<CliArgs> = {}): CliArgs {
|
||||
return {
|
||||
background: false,
|
||||
start: false,
|
||||
launchMpv: false,
|
||||
launchMpvTargets: [],
|
||||
stop: false,
|
||||
toggle: false,
|
||||
toggleVisibleOverlay: false,
|
||||
@@ -169,3 +171,79 @@ test('setup service marks cancelled when popup closes before completion', async
|
||||
assert.equal(cancelled.state.status, 'cancelled');
|
||||
});
|
||||
});
|
||||
|
||||
test('setup service reflects detected Windows mpv shortcuts before preferences are persisted', async () => {
|
||||
await withTempDir(async (root) => {
|
||||
const configDir = path.join(root, 'SubMiner');
|
||||
fs.mkdirSync(configDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(configDir, 'config.jsonc'), '{}');
|
||||
|
||||
const service = createFirstRunSetupService({
|
||||
platform: 'win32',
|
||||
configDir,
|
||||
getYomitanDictionaryCount: async () => 0,
|
||||
detectPluginInstalled: () => false,
|
||||
installPlugin: async () => ({
|
||||
ok: true,
|
||||
pluginInstallStatus: 'installed',
|
||||
pluginInstallPathSummary: null,
|
||||
message: 'ok',
|
||||
}),
|
||||
detectWindowsMpvShortcuts: async () => ({
|
||||
startMenuInstalled: false,
|
||||
desktopInstalled: true,
|
||||
}),
|
||||
onStateChanged: () => undefined,
|
||||
});
|
||||
|
||||
const snapshot = await service.ensureSetupStateInitialized();
|
||||
assert.equal(snapshot.windowsMpvShortcuts.startMenuEnabled, false);
|
||||
assert.equal(snapshot.windowsMpvShortcuts.desktopEnabled, true);
|
||||
assert.equal(snapshot.windowsMpvShortcuts.startMenuInstalled, false);
|
||||
assert.equal(snapshot.windowsMpvShortcuts.desktopInstalled, true);
|
||||
});
|
||||
});
|
||||
|
||||
test('setup service persists Windows mpv shortcut preferences and status with one state write', async () => {
|
||||
await withTempDir(async (root) => {
|
||||
const configDir = path.join(root, 'SubMiner');
|
||||
fs.mkdirSync(configDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(configDir, 'config.jsonc'), '{}');
|
||||
const stateChanges: string[] = [];
|
||||
|
||||
const service = createFirstRunSetupService({
|
||||
platform: 'win32',
|
||||
configDir,
|
||||
getYomitanDictionaryCount: async () => 0,
|
||||
detectPluginInstalled: () => false,
|
||||
installPlugin: async () => ({
|
||||
ok: true,
|
||||
pluginInstallStatus: 'installed',
|
||||
pluginInstallPathSummary: null,
|
||||
message: 'ok',
|
||||
}),
|
||||
applyWindowsMpvShortcuts: async () => ({
|
||||
ok: true,
|
||||
status: 'installed',
|
||||
message: 'shortcuts updated',
|
||||
}),
|
||||
onStateChanged: (state) => {
|
||||
stateChanges.push(state.windowsMpvShortcutLastStatus);
|
||||
},
|
||||
});
|
||||
|
||||
await service.ensureSetupStateInitialized();
|
||||
stateChanges.length = 0;
|
||||
|
||||
const snapshot = await service.configureWindowsMpvShortcuts({
|
||||
startMenuEnabled: false,
|
||||
desktopEnabled: true,
|
||||
});
|
||||
|
||||
assert.equal(snapshot.windowsMpvShortcuts.startMenuEnabled, false);
|
||||
assert.equal(snapshot.windowsMpvShortcuts.desktopEnabled, true);
|
||||
assert.equal(snapshot.state.windowsMpvShortcutLastStatus, 'installed');
|
||||
assert.equal(snapshot.message, 'shortcuts updated');
|
||||
assert.deepEqual(stateChanges, ['installed']);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user