test(github): cover persist, hydrate, and complete open-list misses

Add store persist/hydrate regressions for terminal branch associations
and a server test that a complete empty open list does not query closed
PRs. Inline the open-only matcher state so the next repo target can win.

Co-authored-by: serkraser <serkraser@gmail.com>
This commit is contained in:
Cursor Agent
2026-08-15 04:27:52 +00:00
co-authored by serkraser
parent 5e9e35897f
commit 13cbbc76d7
3 changed files with 120 additions and 7 deletions
@@ -86,4 +86,20 @@ describe('findFirstMatchingPr open-only branch status', () => {
expect(listMock.mock.calls.every((call) => call[0]?.state === 'open')).toBe(true);
expect(listMock.mock.calls.some((call) => call[0]?.state === 'closed')).toBe(false);
});
test('does not query closed PRs when the open list is complete and empty', async () => {
listMock.mockImplementation(async () => ({ data: [] }));
const pr = await findFirstMatchingPr({
octokit: { rest: { pulls: { list: listMock } } },
target: { repo: { owner: 'acme', repo: 'app' }, remoteName: 'origin' },
branch: 'feature',
sourceCandidates: [{ repo: { owner: 'acme', repo: 'app' } }],
force: true,
});
expect(pr).toBeNull();
expect(listMock.mock.calls).toHaveLength(1);
expect(listMock.mock.calls[0]?.[0]?.state).toBe('open');
});
});