Add engagement-only conversation mode

This commit is contained in:
jjbrunton committed 2026-08-14 15:07:54 +01:00
1 parent b7fcc7db05
commit 7af7b211fa
24 files changed
+204 -23

No files matched your search

+8
View File
@@ -324,6 +324,14 @@ describe('validateSubredditDraft', () => {
expect(config?.conversation).toEqual({ mode: 'legacy', maxAutomatedTurns: 3, rapportTurnsBeforeMediaAsk: 3 });
});
it('accepts engagement mode without an automated turn budget', () => {
const { config } = validateSubredditDraft(
draft({ conversationMode: 'engagement', maxAutomatedTurns: '', rapportTurnsBeforeMediaAsk: '' }),
[],
);
expect(config?.conversation).toEqual({ mode: 'engagement', maxAutomatedTurns: 3, rapportTurnsBeforeMediaAsk: 3 });
});
it('requires rapport turns below the total budget for the hybrid mode', () => {
const { errors } = validateSubredditDraft(
draft({ conversationMode: 'r4r-media', maxAutomatedTurns: '4', rapportTurnsBeforeMediaAsk: '4' }),
+14
View File
@@ -500,6 +500,20 @@ describe('subreddits page', () => {
expect(saved[0][1].conversation.mode).toBe('manual');
});
it('applies engagement-only policy without autonomous confirmation', async () => {
renderSubreddits();
const bar = await select('r4r');
await userEvent.setup().selectOptions(
within(bar).getByRole('combobox', { name: 'Set conversation policy for the selected subreddits' }),
'Engagement only',
);
await waitFor(() => expect(saved).toHaveLength(1));
expect(screen.queryByText('Confirm risky settings')).not.toBeInTheDocument();
expect(saved[0][1].conversation.mode).toBe('engagement');
});
it('keeps the hybrid mode valid when bulk-applied to a short turn budget', async () => {
// r/casualconversation defaults to 3 total / 3 rapport, which the hybrid
// mode rejects. A bulk change has no form to fix it, so it must normalise.