chore: minor fixes and cleanup across services and renderer

This commit is contained in:
2026-03-17 19:54:27 -07:00
parent f8e2ae4887
commit 5698121996
7 changed files with 24 additions and 10 deletions

View File

@@ -257,7 +257,11 @@ export function createCoverArtFetcher(
logger: Logger,
options: CoverArtFetcherOptions = {},
): CoverArtFetcher {
const resolveCanonicalTitle = (db: DatabaseSync, videoId: number, fallbackTitle: string): string => {
const resolveCanonicalTitle = (
db: DatabaseSync,
videoId: number,
fallbackTitle: string,
): string => {
const row = db
.prepare(
`

View File

@@ -158,7 +158,10 @@ test('promoteStatsWindowLevel raises stats above overlay level on macOS', () =>
setAlwaysOnTop: (flag: boolean, level?: string, relativeLevel?: number) => {
calls.push(`always-on-top:${flag}:${level ?? 'none'}:${relativeLevel ?? 0}`);
},
setVisibleOnAllWorkspaces: (visible: boolean, options?: { visibleOnFullScreen?: boolean }) => {
setVisibleOnAllWorkspaces: (
visible: boolean,
options?: { visibleOnFullScreen?: boolean },
) => {
calls.push(
`all-workspaces:${visible}:${options?.visibleOnFullScreen === true ? 'fullscreen' : 'plain'}`,
);

View File

@@ -638,9 +638,10 @@ export function annotateTokens(
? computeTokenKnownStatus(token, deps.isKnownWord, deps.knownWordMatchMode)
: false;
const frequencyRank = frequencyEnabled && !prioritizedNameMatch
? filterTokenFrequencyRank(token, pos1Exclusions, pos2Exclusions)
: undefined;
const frequencyRank =
frequencyEnabled && !prioritizedNameMatch
? filterTokenFrequencyRank(token, pos1Exclusions, pos2Exclusions)
: undefined;
const jlptLevel =
jlptEnabled && !prioritizedNameMatch
@@ -650,8 +651,7 @@ export function annotateTokens(
return {
...token,
isKnown,
isNPlusOneTarget:
nPlusOneEnabled && !prioritizedNameMatch ? token.isNPlusOneTarget : false,
isNPlusOneTarget: nPlusOneEnabled && !prioritizedNameMatch ? token.isNPlusOneTarget : false,
frequencyRank,
jlptLevel,
};

View File

@@ -311,7 +311,7 @@ export function createCharacterDictionaryAutoSyncRuntimeService(
mediaId: snapshot.mediaId,
mediaTitle: snapshot.mediaTitle,
message: buildBuildingMessage(snapshot.mediaTitle),
});
});
deps.logInfo?.('[dictionary:auto-sync] rebuilding merged dictionary for active anime set');
merged = await deps.buildMergedDictionary(nextActiveMediaIdValues);
}

View File

@@ -52,6 +52,7 @@ test('composeIpcRuntimeHandlers returns callable IPC handlers and registration b
getKeybindings: () => [],
getConfiguredShortcuts: () => ({}) as never,
getStatsToggleKey: () => 'Backquote',
getMarkWatchedKey: () => 'KeyW',
getControllerConfig: () => ({}) as never,
saveControllerConfig: () => {},
saveControllerPreference: () => {},

View File

@@ -522,7 +522,10 @@ test('getFrequencyRankLabelForToken returns rank only for frequency-colored toke
assert.equal(getFrequencyRankLabelForToken(knownToken, settings), '20');
assert.equal(getFrequencyRankLabelForToken(nPlusOneToken, settings), '20');
assert.equal(getFrequencyRankLabelForToken(outOfRangeToken, settings), null);
assert.equal(getFrequencyRankLabelForToken(nameToken, { ...settings, nameMatchEnabled: true }), null);
assert.equal(
getFrequencyRankLabelForToken(nameToken, { ...settings, nameMatchEnabled: true }),
null,
);
});
test('getJlptLevelLabelForToken returns level when token has jlpt metadata', () => {

View File

@@ -95,7 +95,10 @@ function hasPrioritizedNameMatch(
token: MergedToken,
tokenRenderSettings?: Partial<Pick<TokenRenderSettings, 'nameMatchEnabled'>>,
): boolean {
return (tokenRenderSettings?.nameMatchEnabled ?? DEFAULT_NAME_MATCH_ENABLED) && token.isNameMatch === true;
return (
(tokenRenderSettings?.nameMatchEnabled ?? DEFAULT_NAME_MATCH_ENABLED) &&
token.isNameMatch === true
);
}
function sanitizeFrequencyTopX(value: unknown, fallback: number): number {