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
@@ -171,6 +171,7 @@ describe('dashboard foundation', () => {
|
||||
expect(screen.getByText('Dry run')).toBeInTheDocument();
|
||||
expect(await screen.findByRole('list', { name: 'Recent sent messages' })).toHaveTextContent('A recent opener');
|
||||
expect(screen.getByRole('list', { name: 'Recent sent messages' })).toHaveTextContent('Responded');
|
||||
expect(screen.getByRole('link', { name: 'u/alice' })).toHaveAttribute('href', 'https://www.reddit.com/u/alice');
|
||||
});
|
||||
|
||||
it('keeps stats visible when timers fail and retries only the failed panel', async () => {
|
||||
@@ -200,6 +201,52 @@ describe('dashboard foundation', () => {
|
||||
expect(timerRequests).toBe(2);
|
||||
});
|
||||
|
||||
it('makes usernames in recent activity clickable', async () => {
|
||||
installSuccessfulApi({
|
||||
recentActivity: [{
|
||||
timestamp: Date.now(),
|
||||
type: 'response',
|
||||
message: 'Reply from u/alice',
|
||||
recipient: 'alice',
|
||||
}],
|
||||
});
|
||||
renderDashboard();
|
||||
|
||||
const activity = await screen.findByRole('heading', { name: 'Recent activity' });
|
||||
const panel = activity.closest('section');
|
||||
expect(panel).not.toBeNull();
|
||||
expect(within(panel!).getByRole('link', { name: 'u/alice' })).toHaveAttribute(
|
||||
'href',
|
||||
'https://www.reddit.com/u/alice',
|
||||
);
|
||||
});
|
||||
|
||||
it('opens saved source-post context from a sent activity entry', async () => {
|
||||
installSuccessfulApi({
|
||||
recentActivity: [{
|
||||
timestamp: Date.now(),
|
||||
type: 'sent',
|
||||
message: 'Sent message to u/alice (r/example)',
|
||||
recipient: 'alice',
|
||||
imageUrl: 'https://i.redd.it/source.jpg',
|
||||
postTitle: 'The source post title',
|
||||
postUrl: 'https://www.reddit.com/r/example/comments/source/the_source_post_title/',
|
||||
}],
|
||||
});
|
||||
const user = userEvent.setup();
|
||||
renderDashboard();
|
||||
|
||||
await user.click(await screen.findByRole('button', { name: 'Sent message to u/alice (r/example)' }));
|
||||
|
||||
const dialog = screen.getByRole('dialog', { name: 'The source post title' });
|
||||
expect(within(dialog).getByRole('img', { name: 'Source post: The source post title' })).toHaveAttribute(
|
||||
'src', 'https://i.redd.it/source.jpg',
|
||||
);
|
||||
expect(within(dialog).getByRole('link', { name: 'Open Reddit post' })).toHaveAttribute(
|
||||
'href', 'https://www.reddit.com/r/example/comments/source/the_source_post_title/',
|
||||
);
|
||||
});
|
||||
|
||||
it('styles the recent-messages retry control when its request fails', async () => {
|
||||
installSuccessfulApi();
|
||||
server.use(http.get('/api/messages', () => HttpResponse.json({ error: 'Messages unavailable' }, { status: 503 })));
|
||||
|
||||
Reference in new issue
Block a user