feat: persist settings and enrich conversation context
This commit is contained in:
1 parent
a36723a325
commit
2c100d72b6
84 files changed
+2248
-644
No files matched your search
@@ -16,6 +16,7 @@ const config = {
|
||||
reddit: { prioritizeRecentPosts: false, recentWindowMinutes: 60 },
|
||||
subreddits: [{ name: 'casualconversation', type: 'chat', weight: 2, tone: 'default' }],
|
||||
tones: ['default', 'dominant', 'submissive', 'playful', 'direct', 'gentle', 'kink-friendly', 'teasing'],
|
||||
advanced: { openrouter: { chatModel: 'example/chat-model' } },
|
||||
};
|
||||
|
||||
const server = setupServer();
|
||||
@@ -228,6 +229,25 @@ describe('settings and access', () => {
|
||||
expect(updateRequests).toBe(1);
|
||||
});
|
||||
|
||||
it('validates advanced application JSON before saving', async () => {
|
||||
installConfigApi();
|
||||
let updateRequests = 0;
|
||||
server.use(http.put('/api/config', () => {
|
||||
updateRequests += 1;
|
||||
return HttpResponse.json({ success: true, config, subreddits: config.subreddits });
|
||||
}));
|
||||
const user = userEvent.setup();
|
||||
renderSettings('/settings?section=behaviour');
|
||||
|
||||
const editor = await screen.findByRole('textbox', { name: 'Advanced configuration JSON' });
|
||||
await user.clear(editor);
|
||||
await user.type(editor, 'invalid');
|
||||
await user.click(screen.getByRole('button', { name: 'Save settings' }));
|
||||
|
||||
expect(screen.getByText('Advanced configuration is not valid JSON.')).toBeInTheDocument();
|
||||
expect(updateRequests).toBe(0);
|
||||
});
|
||||
|
||||
it('confirms unusually large hourly limits', async () => {
|
||||
installConfigApi();
|
||||
let updateRequests = 0;
|
||||
@@ -287,6 +307,10 @@ describe('settings and access', () => {
|
||||
expect(importRequests).toBe(1);
|
||||
expect(await screen.findByText('Authenticated')).toBeInTheDocument();
|
||||
expect(screen.getByText(/u\/example-account/)).toBeInTheDocument();
|
||||
expect(screen.getByRole('link', { name: 'u/example-account' })).toHaveAttribute(
|
||||
'href',
|
||||
'https://www.reddit.com/u/example-account',
|
||||
);
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Recheck session' }));
|
||||
expect(statusRequests).toBeGreaterThanOrEqual(2);
|
||||
|
||||
Reference in new issue
Block a user