feat: track received image outcomes
This commit is contained in:
1 parent
50de1c180d
commit
d819a0f1e6
15 files changed
+145
-21
No files matched your search
@@ -155,7 +155,7 @@ describe('dashboard foundation', () => {
|
||||
),
|
||||
http.get('/api/messages', () => HttpResponse.json([{
|
||||
id: 1, postId: 'post-1', recipient: 'alice', subject: 'Hello', message: 'A recent opener',
|
||||
sentAt: Date.now(), gotResponse: true, responseCheckedAt: Date.now(), strategyId: null, chatRoomId: null,
|
||||
sentAt: Date.now(), gotResponse: true, gotImage: false, responseCheckedAt: Date.now(), strategyId: null, chatRoomId: null,
|
||||
}])),
|
||||
);
|
||||
|
||||
|
||||
@@ -36,21 +36,21 @@ describe('PerformancePage', () => {
|
||||
server.use(
|
||||
http.get('/api/analytics/by-subreddit', () =>
|
||||
HttpResponse.json([
|
||||
{ subreddit: 'askuk', totalSent: 40, totalResponses: 12, responseRate: 30 },
|
||||
{ subreddit: 'tiny', totalSent: 3, totalResponses: 2, responseRate: 67 },
|
||||
{ subreddit: 'askuk', totalSent: 40, totalResponses: 12, responseRate: 30, totalImages: 6, imageRate: 15 },
|
||||
{ subreddit: 'tiny', totalSent: 3, totalResponses: 2, responseRate: 67, totalImages: 1, imageRate: 33 },
|
||||
]),
|
||||
),
|
||||
http.get('/api/analytics/by-strategy', () =>
|
||||
HttpResponse.json([
|
||||
{ strategyId: 'friendly', totalSent: 25, totalResponses: 10, responseRate: 40, configured: true },
|
||||
{ strategyId: 'new-test', totalSent: 2, totalResponses: 1, responseRate: 50 },
|
||||
{ strategyId: 'friendly', totalSent: 25, totalResponses: 10, responseRate: 40, totalImages: 5, imageRate: 20, configured: true },
|
||||
{ strategyId: 'new-test', totalSent: 2, totalResponses: 1, responseRate: 50, totalImages: 1, imageRate: 50 },
|
||||
]),
|
||||
),
|
||||
http.get('/api/analytics/trend', ({ request }) => {
|
||||
expect(new URL(request.url).searchParams.get('days')).toBe('30');
|
||||
return HttpResponse.json([
|
||||
{ date: '2026-08-07', totalSent: 10, totalResponses: 2, responseRate: 20 },
|
||||
{ date: '2026-08-08', totalSent: 8, totalResponses: 4, responseRate: 50 },
|
||||
{ date: '2026-08-07', totalSent: 10, totalResponses: 2, responseRate: 20, totalImages: 1, imageRate: 10 },
|
||||
{ date: '2026-08-08', totalSent: 8, totalResponses: 4, responseRate: 50, totalImages: 2, imageRate: 25 },
|
||||
]);
|
||||
}),
|
||||
http.get('/api/successful', () =>
|
||||
@@ -64,6 +64,7 @@ describe('PerformancePage', () => {
|
||||
responseSnippet: 'That sounds lovely!',
|
||||
subreddit: 'askuk',
|
||||
createdAt: Date.parse('2026-08-08T10:00:00Z'),
|
||||
gotImage: true,
|
||||
},
|
||||
]),
|
||||
),
|
||||
@@ -76,12 +77,15 @@ describe('PerformancePage', () => {
|
||||
expect(within(subredditTable).getByText('n = 40')).toBeInTheDocument();
|
||||
expect(within(subredditTable).getByText('n = 3')).toBeInTheDocument();
|
||||
expect(within(subredditTable).getByText('Low confidence')).toBeInTheDocument();
|
||||
expect(within(subredditTable).getByRole('columnheader', { name: 'Images' })).toBeInTheDocument();
|
||||
expect(within(subredditTable).getByText('15%')).toBeInTheDocument();
|
||||
const strategyTable = screen.getByRole('table', { name: 'Strategy performance' });
|
||||
expect(within(strategyTable).getByText('n = 25')).toBeInTheDocument();
|
||||
expect(within(strategyTable).getByText('Configured')).toBeInTheDocument();
|
||||
expect(screen.getByRole('list', { name: '30 day response trend' })).toHaveTextContent('50%');
|
||||
expect(screen.getByRole('article', { name: 'Successful example from askuk' })).toHaveTextContent('A thoughtful opener');
|
||||
expect(screen.getByRole('article', { name: 'Successful example from askuk' })).toHaveTextContent('That sounds lovely!');
|
||||
expect(screen.getByRole('article', { name: 'Successful example from askuk' })).toHaveTextContent('Image received');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user