Expose browsing daily target range
This commit is contained in:
1 parent
e890f74478
commit
a71ad56f3c
4 files changed
+83
-2
No files matched your search
@@ -287,6 +287,38 @@ describe('GrowthPage', () => {
|
||||
])));
|
||||
});
|
||||
|
||||
it('updates the browsing daily target range together', async () => {
|
||||
renderGrowth();
|
||||
const user = userEvent.setup();
|
||||
|
||||
const minimum = await screen.findByLabelText('Daily minimum');
|
||||
await user.clear(minimum);
|
||||
await user.type(minimum, '6');
|
||||
const maximum = screen.getByLabelText('Daily maximum');
|
||||
await user.clear(maximum);
|
||||
await user.type(maximum, '9');
|
||||
await user.click(screen.getByRole('button', { name: 'Save daily range' }));
|
||||
|
||||
await waitFor(() => expect(requests).toContainEqual(expect.objectContaining({
|
||||
method: 'PATCH', body: { dailyTargetMin: 6, dailyTargetMax: 9 },
|
||||
})));
|
||||
});
|
||||
|
||||
it('rejects an inverted browsing daily target range in the dashboard', async () => {
|
||||
renderGrowth();
|
||||
const user = userEvent.setup();
|
||||
|
||||
const minimum = await screen.findByLabelText('Daily minimum');
|
||||
await user.clear(minimum);
|
||||
await user.type(minimum, '8');
|
||||
const maximum = screen.getByLabelText('Daily maximum');
|
||||
await user.clear(maximum);
|
||||
await user.type(maximum, '4');
|
||||
|
||||
expect(screen.getByRole('button', { name: 'Save daily range' })).toBeDisabled();
|
||||
expect(screen.getAllByText(/minimum no greater than the maximum/i)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('shows an empty state when there are no accounts', async () => {
|
||||
overviewPayload = [];
|
||||
renderGrowth();
|
||||
|
||||
Reference in new issue
Block a user