feat: 简化微信渠道账号连接

This commit is contained in:
2026-09-14 12:05:16 +08:00
parent a721b8fb7e
commit 21e707d9c4
21 changed files with 238 additions and 1078 deletions

View File

@@ -91,6 +91,19 @@ it('guides an unconfirmed WeChat verification back to its code entry without cla
expect(api.resolvePending).toHaveBeenCalledWith('wechat-code', false);
});
it('offers only explicit discard for a recovery record whose channel operation was removed', async () => {
api.recovery.mockResolvedValueOnce({ recent: null, pending: [{ id: 'channel-policy-old', operation: 'channelPolicy',
input: { slug: draft.slug, channel_account_id: 'wechat-1' }, created_at: '2026-09-13T01:00:00Z' }] })
.mockResolvedValue({ recent: null, pending: [] });
api.resolvePending.mockResolvedValue({ operation: 'channelPolicy', discarded: true, retired: true });
open();
expect(await screen.findByText(/旧版联系人权限操作(已移除)/)).toBeVisible();
expect(screen.queryByRole('button', { name: '重试并确认结果' })).toBeNull();
fireEvent.click(screen.getByRole('button', { name: '丢弃旧记录' }));
await screen.findByText(/旧版联系人权限操作已移除/);
expect(api.resolvePending).toHaveBeenCalledWith('channel-policy-old', false);
});
it('keeps the same creation operation after a lost response', async () => {
api.list.mockResolvedValue({ agents: [], next_cursor: null });
api.create.mockRejectedValueOnce(new Error('连接中断')).mockResolvedValueOnce(draft);