fix(library): exclude light novels from anilist manga resolve

This commit is contained in:
afiqzudinhadi 2026-08-05 15:00:16 +08:00
parent 8a046a0ea2
commit 3eb89772c7
2 changed files with 14 additions and 1 deletions

View file

@ -33,7 +33,7 @@ const ANILIST_MEDIA_FIELDS = `
const ANILIST_SEARCH_QUERY = `query ($q: String) { const ANILIST_SEARCH_QUERY = `query ($q: String) {
Page(perPage: 8) { Page(perPage: 8) {
media(search: $q, type: MANGA) { media(search: $q, type: MANGA, format_not_in: [NOVEL]) {
${ANILIST_MEDIA_FIELDS} ${ANILIST_MEDIA_FIELDS}
} }
} }

View file

@ -920,6 +920,19 @@ describe('mangaSpec.resolve — AniList primary', () => {
expect(result).toEqual({ mal_id: '116778', anilist_id: '105778' }); expect(result).toEqual({ mal_id: '116778', anilist_id: '105778' });
expect(mangadexCalled).toBe(false); expect(mangadexCalled).toBe(false);
}); });
test('search query includes format_not_in: [NOVEL] to exclude light novels', async () => {
let capturedQuery = '';
const deps = makeDeps({
http: async () => ({ data: [] }),
httpPostJson: async (url: string, body: any) => {
capturedQuery = body.query;
return anilistPage([{ id: 105778, idMal: 116778, title: { romaji: 'Overlord', english: 'Overlord' } }]);
},
});
await mangaSpec.resolve(ctxFor({ title: 'Overlord' }, ''), deps);
expect(capturedQuery).toContain('format_not_in: [NOVEL]');
});
}); });
describe('mangaSpec.sync — AniList primary enrich', () => { describe('mangaSpec.sync — AniList primary enrich', () => {