Repair metadata title on queue retry
This commit is contained in:
1 parent
a500ea7c3f
commit
26d6cd59fc
2 files changed
+31
No files matched your search
@@ -12,6 +12,16 @@ async function confirm(item) {
|
||||
return item;
|
||||
}
|
||||
|
||||
async function retry(item) {
|
||||
const service = Object.create(ScraperService.prototype);
|
||||
service.state = { queue: [item], currentIds: {}, sourcePaused: {}, circuits: {}, incidents: [], paused: true };
|
||||
service.event = async () => {};
|
||||
service.recomputeStatus = () => {};
|
||||
service.resolveAdapter = () => ({ adapter: { id: item.source } });
|
||||
await service.control('retry', item.id);
|
||||
return item;
|
||||
}
|
||||
|
||||
test('confirming an inspection uses the canonical title for automatic metadata lookup', async () => {
|
||||
const item = await confirm({ id: 'job', seriesId: '01J76XYFHVMSQVDJPQ42TN2XYN',
|
||||
title: '01J76XYFHVMSQVDJPQ42TN2XYN', metadataSearch: '01J76XYFHVMSQVDJPQ42TN2XYN',
|
||||
@@ -36,3 +46,14 @@ test('legacy automatic title searches are replaced with the inspected canonical
|
||||
kind: 'inspection', status: 'ready' });
|
||||
assert.equal(item.metadataSearch, item.sourceTitle);
|
||||
});
|
||||
|
||||
test('retry repairs a legacy URL-ID lookup before requeueing it', async () => {
|
||||
const item = await retry({ id: 'job', seriesId: '01J76XYFHVMSQVDJPQ42TN2XYN',
|
||||
title: '01J76XYFHVMSQVDJPQ42TN2XYN', metadataSearch: '01J76XYFHVMSQVDJPQ42TN2XYN',
|
||||
sourceTitle: 'The Exiled Heavy Knight Knows How to Game the System', source: 'weebcentral',
|
||||
status: 'unavailable', error: 'AniList HTTP 404' });
|
||||
assert.equal(item.metadataSearch, item.sourceTitle);
|
||||
assert.equal(item.title, item.sourceTitle);
|
||||
assert.equal(item.status, 'queued');
|
||||
assert.equal(item.error, undefined);
|
||||
});
|
||||
Reference in new issue
Block a user