Compare commits
No commits in common. "d01de1dfbfb6673ffa613c9fc876e6e0827839e3" and "770b8e0727fec8b236089a74651a888d146d38ec" have entirely different histories.
d01de1dfbf
...
770b8e0727
|
|
@ -1,5 +1,5 @@
|
||||||
import { type ReactNode } from "react";
|
import { type ReactNode } from "react";
|
||||||
import { fireEvent, render, screen } from "@testing-library/react";
|
import { render, screen } from "@testing-library/react";
|
||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import { ThemeProvider } from "@mui/material/styles";
|
import { ThemeProvider } from "@mui/material/styles";
|
||||||
|
|
@ -97,21 +97,14 @@ test("conversion retries the same accepted quote, reference, note, and key after
|
||||||
|
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
await user.click(screen.getByRole("button", { name: "Test login" }));
|
await user.click(screen.getByRole("button", { name: "Test login" }));
|
||||||
fireEvent.change(await screen.findByRole("textbox", { name: /Partner reference/ }), {
|
await user.type(await screen.findByRole("textbox", { name: /Partner reference/ }), order.partnerReference);
|
||||||
target: { value: order.partnerReference },
|
await user.type(screen.getByRole("textbox", { name: /Order note/ }), order.note);
|
||||||
});
|
|
||||||
fireEvent.change(screen.getByRole("textbox", { name: /Order note/ }), {
|
|
||||||
target: { value: order.note },
|
|
||||||
});
|
|
||||||
await user.click(screen.getByRole("button", { name: "Record partner order" }));
|
await user.click(screen.getByRole("button", { name: "Record partner order" }));
|
||||||
expect(attempts).toEqual([{
|
|
||||||
quoteId, partnerReference: order.partnerReference, note: order.note, idempotencyKey: expect.any(String),
|
|
||||||
}]);
|
|
||||||
|
|
||||||
await user.click(await screen.findByRole("button", { name: "Retry partner order" }));
|
await user.click(await screen.findByRole("button", { name: "Retry partner order" }));
|
||||||
await screen.findByRole("button", { name: "Cancel partner order" });
|
await screen.findByRole("button", { name: "Cancel partner order" });
|
||||||
|
|
||||||
expect(location.pathname).toBe(`${route}/${orderId}`);
|
expect(location.pathname).toBe(`${route}/${orderId}`);
|
||||||
|
expect(attempts[0]).toEqual({ quoteId, partnerReference: order.partnerReference, note: order.note, idempotencyKey: expect.any(String) });
|
||||||
expect(attempts).toEqual([attempts[0], attempts[0]]);
|
expect(attempts).toEqual([attempts[0], attempts[0]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -135,14 +128,13 @@ test("a received partner order can be cancelled and the same cancellation key ca
|
||||||
|
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
await user.click(screen.getByRole("button", { name: "Test login" }));
|
await user.click(screen.getByRole("button", { name: "Test login" }));
|
||||||
fireEvent.change(await screen.findByRole("textbox", { name: /Cancellation reason/ }), { target: { value: reason } });
|
await user.type(await screen.findByRole("textbox", { name: /Cancellation reason/ }), reason);
|
||||||
await user.click(screen.getByRole("button", { name: "Cancel partner order" }));
|
await user.click(screen.getByRole("button", { name: "Cancel partner order" }));
|
||||||
expect(attempts).toEqual([{ reason, idempotencyKey: expect.any(String) }]);
|
|
||||||
|
|
||||||
await user.click(await screen.findByRole("button", { name: "Retry cancellation" }));
|
await user.click(await screen.findByRole("button", { name: "Retry cancellation" }));
|
||||||
await screen.findByText(new RegExp(reason));
|
await screen.findByText(new RegExp(reason));
|
||||||
|
|
||||||
expect(screen.queryByRole("button", { name: "Cancel partner order" })).toBeNull();
|
expect(screen.queryByRole("button", { name: "Cancel partner order" })).toBeNull();
|
||||||
|
expect(attempts[0]).toEqual({ reason, idempotencyKey: expect.any(String) });
|
||||||
expect(attempts).toEqual([attempts[0], attempts[0]]);
|
expect(attempts).toEqual([attempts[0], attempts[0]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -180,9 +172,7 @@ test("a cancellation blocked by an active receipt keeps the saved order and expl
|
||||||
|
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
await user.click(screen.getByRole("button", { name: "Test login" }));
|
await user.click(screen.getByRole("button", { name: "Test login" }));
|
||||||
fireEvent.change(await screen.findByRole("textbox", { name: /Cancellation reason/ }), {
|
await user.type(await screen.findByRole("textbox", { name: /Cancellation reason/ }), "Partner changed the order");
|
||||||
target: { value: "Partner changed the order" },
|
|
||||||
});
|
|
||||||
await user.click(screen.getByRole("button", { name: "Cancel partner order" }));
|
await user.click(screen.getByRole("button", { name: "Cancel partner order" }));
|
||||||
|
|
||||||
await screen.findByText("Reverse active payments before cancelling the order");
|
await screen.findByText("Reverse active payments before cancelling the order");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue