Reviews: a store read that failed everywhere is an error, not an empty fresh list; Reviews tab says Apple's API can lag and Play returns 7 days; pitfall 106
This commit is contained in:
parent
0e88e4293a
commit
75bf62e125
7 changed files with 50 additions and 8 deletions
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test';
|
|||
import { parseFrontMatter, stringifyFrontMatter } from '../cli/lib/frontmatter';
|
||||
import {
|
||||
checkReply, draftMarkdown, draftName, filterReviews, markSent, parseAppleReviews, parseDraft, parsePlayReviews, REPLY_LIMITS, REPLY_PLACEHOLDER,
|
||||
replyRequest, sendPlan,
|
||||
replyRequest, sendPlan, settleStoreReads,
|
||||
} from '../cli/lib/reviews';
|
||||
import { FORBIDDEN_ARGS, TOOLS, toArgv } from '../cli/mcp-tools';
|
||||
|
||||
|
|
@ -104,3 +104,18 @@ describe('reviews', () => {
|
|||
expect(TOOLS.some(x => x.command.includes('send'))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('settleStoreReads', () => {
|
||||
const r = { store: 'apple' as const, id: '1', rating: 5, body: 'x', date: '2026-10-01T00:00:00.000Z' };
|
||||
test('one failed store does not hide the other, and is reported', () => {
|
||||
const o = settleStoreReads([{ store: 'apple', reviews: [r] }, { store: 'play', error: 'denied' }]);
|
||||
expect(o.reviews).toEqual([r]);
|
||||
expect(o.errors).toEqual(['play: denied']);
|
||||
});
|
||||
test('every asked store failed: throws instead of an empty "all fine" list', () => {
|
||||
expect(() => settleStoreReads([{ store: 'apple', error: 'expired key' }])).toThrow('apple: expired key');
|
||||
});
|
||||
test('no store asked: empty, no error', () => {
|
||||
expect(settleStoreReads([])).toEqual({ reviews: [], errors: [] });
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue