fix(library): surface comic vine api errors + sync summary transparency
This commit is contained in:
parent
f146de1b76
commit
d76ed2631b
5 changed files with 98 additions and 6 deletions
|
|
@ -329,6 +329,16 @@ describe('comicSpec.resolve', () => {
|
|||
const result = await comicSpec.resolve(ctx, deps);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test('Comic Vine error envelope (invalid key) -> null, logged', async () => {
|
||||
const deps = makeDeps({
|
||||
http: async () => ({ error: 'Invalid API Key', status_code: 100, results: [] }),
|
||||
getKey: () => 'bad-key',
|
||||
});
|
||||
const result = await comicSpec.resolve(ctxFor({ title: 'Absolute Batman' }), deps);
|
||||
expect(result).toBeNull();
|
||||
expect(deps.logCalls.some(m => m.includes('Invalid API Key'))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('comicSpec.sync — no id / no key', () => {
|
||||
|
|
@ -385,6 +395,17 @@ describe('comicSpec.sync — comicvine enrich', () => {
|
|||
expect(deps.notifyCalls).toEqual([]);
|
||||
});
|
||||
|
||||
test('Comic Vine error envelope (invalid key) -> null, notify + log', async () => {
|
||||
const deps = makeDeps({
|
||||
http: async () => ({ error: 'Invalid API Key', status_code: 100, results: [] }),
|
||||
getKey: () => 'bad-key',
|
||||
});
|
||||
const result = await comicSpec.sync(ctxFor({ comicvine_id: '195824' }), deps);
|
||||
expect(result).toBeNull();
|
||||
expect(deps.notifyCalls.some(m => m.includes('Invalid API Key'))).toBe(true);
|
||||
expect(deps.logCalls.some(m => m.includes('Invalid API Key'))).toBe(true);
|
||||
});
|
||||
|
||||
test('fetches from GET /volume/4050-{id}/ with api_key + format=json', async () => {
|
||||
let calledUrl = '';
|
||||
const deps = makeDeps({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue