Expose Greatest source links and safe scraper inspection

This commit is contained in:
Codex committed 2026-10-09 14:53:52 +02:00
1 parent f493afcc18
commit d0275223a7
7 files changed
+238 -6

No files matched your search

+19
View File
@@ -2,6 +2,7 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { loadCatalog, findOwned, countsFor, scoreFor } = require('../greatest');
const { seriesLink, hosterLinks } = require('../greatest/hosters');
test('curated manga catalog has unique identities and ordered five-year periods', () => {
const catalog = loadCatalog();
@@ -30,3 +31,21 @@ test('library matching and vote aggregation stay independent of scraper data', (
assert.deepEqual(counts, { flame: 1, good: 1, neutral: 0, skip: 0 });
assert.equal(scoreFor(counts), 4);
});
test('hoster links use confirmed series URLs and do not mistake unrelated queue entries for matches', () => {
const entry = { title: 'BLAME!', aliases: ['Blame'] };
const weeb = 'https://weebcentral.com/series/01J76XY8CJ2RJGWMHM69ZS0J3H';
const dex = 'https://mangadex.org/title/06a37094-b3ba-4f25-bf2b-54c9751e0e91/bleach';
const owned = { id: 'BLAME!', meta: { sources: [{ name: 'WeebCentral', url: weeb }] } };
const result = hosterLinks(entry, owned, [
{ id: 'match', title: 'blame', url: weeb, status: 'complete', kind: 'download' },
{ id: 'other', title: 'Bleach', url: dex, status: 'queued', kind: 'download' },
]);
assert.equal(result.links.length, 1);
assert.equal(result.links[0].source, 'weebcentral');
assert.equal(result.jobs.length, 1);
assert.equal(result.jobs[0].status, 'complete');
assert.equal(seriesLink('https://weebcentral.com/chapters/01J76XY8CJ2RJGWMHM69ZS0J3H'), null);
assert.equal(seriesLink('http://weebcentral.com/series/01J76XY8CJ2RJGWMHM69ZS0J3H'), null);
assert.equal(seriesLink(dex).seriesId, '06a37094-b3ba-4f25-bf2b-54c9751e0e91');
});