Attempt the channel lookup once per titled row
This commit is contained in:
@@ -1596,18 +1596,25 @@ void (async () => {
|
||||
]);
|
||||
|
||||
const label = (url: string) => url.split("=")[1] ?? url.split("/").pop();
|
||||
// A titled row is still pending once for its channel (author) lookup.
|
||||
const pending = store.pendingTitles(10).map(row => label(row.url));
|
||||
assert.deepEqual(pending.sort(), ["notitle", "short"].sort());
|
||||
assert.deepEqual(pending.sort(), ["notitle", "short", "withtitle"].sort());
|
||||
|
||||
const target = store.pendingTitles(10).find(row => row.url.includes("notitle"));
|
||||
const dead = store.pendingTitles(10).find(row => row.url.includes("youtu.be"));
|
||||
const titled = store.pendingTitles(10).find(row => row.url.includes("withtitle"));
|
||||
assert.ok(target);
|
||||
assert.ok(dead);
|
||||
assert.ok(titled);
|
||||
|
||||
store.markTitle(target.id, "Resolved Title");
|
||||
assert.equal(store.getMedia(target.id)?.title, "Resolved Title");
|
||||
assert.equal(store.pendingTitles(10).some(row => row.id === target.id), false);
|
||||
|
||||
store.markTitle(titled.id, "Has a title", "Some Channel");
|
||||
assert.equal(store.getMedia(titled.id)?.title_author, "Some Channel");
|
||||
assert.equal(store.pendingTitles(10).some(row => row.id === titled.id), false);
|
||||
|
||||
store.markTitleError(dead.id, "no title after 1 attempt(s)");
|
||||
assert.equal(store.pendingTitles(10).some(row => row.id === dead.id), false);
|
||||
assert.equal(store.previewCounts().titlePending, 0);
|
||||
|
||||
Reference in New Issue
Block a user