mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-27 18:12:05 -07:00
fix: address latest coderabbit review
This commit is contained in:
@@ -68,6 +68,8 @@ test('texthooker precheck no-ops for texthooker command', () => {
|
||||
test('texthooker precheck transitions for youtube playback startup prereqs', () => {
|
||||
let mode = true;
|
||||
let prereqs = 0;
|
||||
let warmups = 0;
|
||||
let logs = 0;
|
||||
const handlePrecheck = createHandleTexthookerOnlyModeTransitionHandler({
|
||||
isTexthookerOnlyMode: () => mode,
|
||||
setTexthookerOnlyMode: (enabled) => {
|
||||
@@ -77,12 +79,18 @@ test('texthooker precheck transitions for youtube playback startup prereqs', ()
|
||||
ensureOverlayStartupPrereqs: () => {
|
||||
prereqs += 1;
|
||||
},
|
||||
startBackgroundWarmups: () => {},
|
||||
logInfo: () => {},
|
||||
startBackgroundWarmups: () => {
|
||||
warmups += 1;
|
||||
},
|
||||
logInfo: () => {
|
||||
logs += 1;
|
||||
},
|
||||
});
|
||||
|
||||
handlePrecheck({ youtubePlay: 'https://youtube.com/watch?v=abc', texthooker: false } as never);
|
||||
|
||||
assert.equal(mode, false);
|
||||
assert.equal(prereqs, 1);
|
||||
assert.equal(warmups, 1);
|
||||
assert.equal(logs, 1);
|
||||
});
|
||||
|
||||
@@ -144,13 +144,13 @@ export function createPrepareYoutubePlaybackInMpvHandler(deps: YoutubePlaybackLa
|
||||
// Continue polling until media tracks are actually available.
|
||||
}
|
||||
}
|
||||
const pathChanged = currentPath !== previousPath;
|
||||
const pathDiffersFromInitial = currentPath !== previousPath;
|
||||
const matchesChangedTarget =
|
||||
currentPath === targetUrl ||
|
||||
(isYoutubeMediaPath(currentPath) &&
|
||||
isYoutubeMediaPath(targetUrl) &&
|
||||
pathMatchesYoutubeTarget(currentPath, targetUrl));
|
||||
if (pathChanged && matchesChangedTarget) {
|
||||
if (pathDiffersFromInitial && matchesChangedTarget) {
|
||||
if (deps.requestProperty) {
|
||||
try {
|
||||
const trackList = await deps.requestProperty('track-list');
|
||||
|
||||
Reference in New Issue
Block a user