Configure browsing session pacing and size

This commit is contained in:
jjbrunton committed 2026-08-11 22:17:18 +01:00
1 parent 1fd154e1eb
commit e890f74478
14 files changed
+201 -56

No files matched your search

+21
View File
@@ -54,6 +54,7 @@ function browsing(includeRecent = false) {
quietHours: { enabled: true, startHour: 23, endHour: 7 },
minimumGapMs: 2_700_000,
jitterMs: 900_000,
selectionsPerSession: 1,
allowNsfw: false,
autoVoteEnabled: false,
nextDueAt: null,
@@ -266,6 +267,26 @@ describe('GrowthPage', () => {
})));
});
it('updates browsing session pacing and size', async () => {
renderGrowth();
const user = userEvent.setup();
const gap = await screen.findByLabelText('Minimum session gap');
await user.clear(gap);
await user.type(gap, '90');
await user.click(screen.getByRole('button', { name: 'Save session gap' }));
const size = screen.getByLabelText('Selections per session');
await user.clear(size);
await user.type(size, '4');
await user.click(screen.getByRole('button', { name: 'Save session size' }));
await waitFor(() => expect(requests).toEqual(expect.arrayContaining([
expect.objectContaining({ method: 'PATCH', body: { minimumGapMs: 5_400_000 } }),
expect.objectContaining({ method: 'PATCH', body: { selectionsPerSession: 4 } }),
])));
});
it('shows an empty state when there are no accounts', async () => {
overviewPayload = [];
renderGrowth();