Add Greatest of All Time manga dashboard

This commit is contained in:
Codex committed 2026-10-09 10:10:34 +02:00
1 parent c8dd46d0fb
commit 5df94db9a3
16 files changed
+2717 -1

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
'use strict';
const test = require('node:test');
const assert = require('node:assert/strict');
const { loadCatalog, findOwned, countsFor, scoreFor } = require('../greatest');
test('curated manga catalog has unique identities and ordered five-year periods', () => {
const catalog = loadCatalog();
assert.equal(catalog.periods.length, 13);
assert.equal(catalog.entries.length, 106);
for (const [index, period] of catalog.periods.entries()) {
const entries = catalog.entries.filter(entry => entry.period === period);
assert.ok(entries.length >= 5 && entries.length <= 10);
assert.deepEqual(entries.map(entry => entry.rank), entries.map((_, rank) => rank + 1));
assert.ok(entries.every(entry => entry.periodOrder === index));
}
assert.equal(catalog.entries.find(entry => entry.title === 'Phoenix').year, 1954);
assert.equal(catalog.entries.find(entry => entry.title === 'JoJo\'s Bizarre Adventure').year, 1987);
});
test('library matching and vote aggregation stay independent of scraper data', () => {
const catalog = loadCatalog();
const berserk = catalog.entries.find(entry => entry.title === 'Berserk');
const manga = { id: 'local-Berserk', title: 'Berserk', meta: {} };
assert.equal(findOwned(berserk, [manga]), manga);
assert.equal(findOwned(berserk, [{ id: 'different', title: 'Berserker', meta: {} }]), null);
const votes = { ada: { [berserk.id]: 'flame' }, bob: { [berserk.id]: 'good' }, gone: { [berserk.id]: 'skip' } };
const counts = countsFor(berserk.id, votes, { ada: {}, bob: {} });
assert.deepEqual(counts, { flame: 1, good: 1, neutral: 0, skip: 0 });
assert.equal(scoreFor(counts), 4);
});