Fix Windows mpv logging and add log export (#88)

This commit is contained in:
2026-05-26 00:31:38 -07:00
committed by GitHub
parent 43ebc7d371
commit 11c196821d
150 changed files with 2748 additions and 582 deletions
@@ -0,0 +1,55 @@
import { strict as assert } from 'node:assert';
import { test } from 'node:test';
import {
CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE,
openCharacterDictionaryManagerWithConfigGate,
type CharacterDictionaryManagerNotificationType,
} from './character-dictionary-manager-gate';
function makeDeps(options: {
enabled?: boolean;
notificationType?: CharacterDictionaryManagerNotificationType;
}) {
const calls: string[] = [];
return {
calls,
deps: {
isCharacterDictionaryEnabled: () => options.enabled ?? false,
getNotificationType: () => options.notificationType ?? 'osd',
openManager: () => calls.push('open'),
showOsd: (message: string) => calls.push(`osd:${message}`),
showDesktopNotification: (title: string, opts: { body: string }) =>
calls.push(`system:${title}:${opts.body}`),
logWarn: (message: string) => calls.push(`warn:${message}`),
},
};
}
test('opens character dictionary manager when character dictionary is enabled', () => {
const { calls, deps } = makeDeps({ enabled: true, notificationType: 'both' });
openCharacterDictionaryManagerWithConfigGate(deps);
assert.deepEqual(calls, ['open']);
});
test('routes disabled manager notification to configured surfaces', () => {
for (const [type, expected] of [
['osd', [`osd:${CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE}`]],
['system', [`system:SubMiner:${CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE}`]],
[
'both',
[
`osd:${CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE}`,
`system:SubMiner:${CHARACTER_DICTIONARY_MANAGER_DISABLED_MESSAGE}`,
],
],
['none', []],
] as const) {
const { calls, deps } = makeDeps({ enabled: false, notificationType: type });
openCharacterDictionaryManagerWithConfigGate(deps);
assert.deepEqual(calls, expected);
}
});