Skip to content

Commit

Permalink
fix test 11
Browse files Browse the repository at this point in the history
  • Loading branch information
Quanmuito committed Jan 27, 2024
1 parent d9eb82b commit 0a547ed
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ const deliveryCases: string[][] = [
test.each(deliveryCases)(
'Cart value, delivery distance, number of items, order time is %p, %p, %p, %p respectively and result should be %p',
async (cv, dd, ni, dt, expected) => {
const orderTimeInput = await screen.findByLabelText(/order time/i);
fireEvent.change(orderTimeInput, { target: { value: dt } });

const numberOfItemsInput = await screen.findByLabelText(/number of items/i);
userEvent.clear(numberOfItemsInput);
userEvent.type(numberOfItemsInput, ni);
const cartValueInput = await screen.findByLabelText(/cart value/i);
userEvent.clear(cartValueInput);
userEvent.type(cartValueInput, cv);

const deliveryDistanceInput = await screen.findByLabelText(/delivery distance/i);
userEvent.clear(deliveryDistanceInput);
userEvent.type(deliveryDistanceInput, dd);

const cartValueInput = await screen.findByLabelText(/cart value/i);
userEvent.clear(cartValueInput);
userEvent.type(cartValueInput, cv);
const numberOfItemsInput = await screen.findByLabelText(/number of items/i);
userEvent.clear(numberOfItemsInput);
userEvent.type(numberOfItemsInput, ni);

const orderTimeInput = await screen.findByLabelText(/order time/i);
fireEvent.change(orderTimeInput, { target: { value: dt } });

act(() => userEvent.keyboard('{Enter}'));
act(() => userEvent.click(screen.getByLabelText(/calculate delivery price/i)));
const result = await screen.findByTestId('fee');
expect(result).toHaveTextContent(expected);
}
Expand Down

0 comments on commit 0a547ed

Please sign in to comment.