Prioritize conversation replies
This commit is contained in:
1 parent
f55ae7ddf8
commit
9b86cee9be
13 files changed
+535
-39
No files matched your search
@@ -220,6 +220,36 @@ describe('RedditAccountRuntimeManager', () => {
|
||||
});
|
||||
|
||||
describe('account runtime isolation', () => {
|
||||
it('does not accept new outreach while the account has actionable replies', async () => {
|
||||
const stored = account('reply_first');
|
||||
const hasActionableReplies = vi.fn().mockResolvedValue(true);
|
||||
const runtime = new RedditAccountRuntime(
|
||||
{
|
||||
accountId: stored.accountId,
|
||||
redditUsername: stored.redditUsername,
|
||||
matrixUserId: stored.matrixUserId!,
|
||||
cookies: [],
|
||||
matrixCredentials: JSON.parse(stored.matrixCredentialsJson),
|
||||
updatedAt: stored.updatedAt,
|
||||
},
|
||||
{
|
||||
accountAuth: {
|
||||
isFullyAuthenticated: () => true,
|
||||
ensureFullyAuthenticated: async () => true,
|
||||
},
|
||||
conversationAutomation: { hasActionableReplies },
|
||||
chatService: { getInvitationCooldown: () => null },
|
||||
rateLimiter: { getTimers: () => ({ nextMessageAvailableAt: null }) },
|
||||
} as unknown as RedditAccountRuntimeResources,
|
||||
{ start: vi.fn(), stop: vi.fn() },
|
||||
);
|
||||
await runtime.start();
|
||||
|
||||
expect(await runtime.canAcceptPost()).toBe(false);
|
||||
hasActionableReplies.mockResolvedValue(false);
|
||||
expect(await runtime.canAcceptPost()).toBe(true);
|
||||
});
|
||||
|
||||
it('uses the Reddit fullname for auth while retaining the Matrix runtime owner', () => {
|
||||
expect(runtimeAuthenticatedAccount(
|
||||
{ matrixUserId: '@t2_1u57iqxxbv:reddit.com' },
|
||||
|
||||
Reference in new issue
Block a user