Use inspected manga title for metadata lookup
This commit is contained in:
1 parent
da40d73f02
commit
a500ea7c3f
2 files changed
+51
No files matched your search
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { ScraperService } = require('../service');
|
||||
|
||||
async function confirm(item) {
|
||||
const service = Object.create(ScraperService.prototype);
|
||||
service.state = { queue: [item], currentIds: {}, sourcePaused: {} };
|
||||
service.event = async () => {};
|
||||
await service.control('confirm', 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',
|
||||
sourceTitle: 'The Exiled Heavy Knight Knows How to Game the System', kind: 'inspection', status: 'ready' });
|
||||
assert.equal(item.title, item.sourceTitle);
|
||||
assert.equal(item.metadataSearch, item.sourceTitle);
|
||||
assert.equal(item.metadataSearchExplicit, true);
|
||||
assert.equal(item.kind, 'download');
|
||||
});
|
||||
|
||||
test('confirming an inspection preserves an explicitly supplied metadata search', async () => {
|
||||
const item = await confirm({ id: 'job', seriesId: 'series-id', title: 'Heavy Knight',
|
||||
metadataSearch: 'Heavy Knight (Romanized Title)', metadataSearchExplicit: true,
|
||||
sourceTitle: 'The Exiled Heavy Knight Knows How to Game the System', kind: 'inspection', status: 'ready' });
|
||||
assert.equal(item.metadataSearch, 'Heavy Knight (Romanized Title)');
|
||||
assert.equal(item.title, 'Heavy Knight');
|
||||
});
|
||||
|
||||
test('legacy automatic title searches are replaced with the inspected canonical title', async () => {
|
||||
const item = await confirm({ id: 'job', seriesId: 'series-id', title: 'heavy-knight-slug',
|
||||
metadataSearch: 'heavy-knight-slug', sourceTitle: 'The Exiled Heavy Knight Knows How to Game the System',
|
||||
kind: 'inspection', status: 'ready' });
|
||||
assert.equal(item.metadataSearch, item.sourceTitle);
|
||||
});
|
||||
Reference in new issue
Block a user