saleor-dashboard/src/orders/components/OrderAddTransaction/OrderAddTransaction.test.tsx
Jonatan Witoszek 13ca6bbba8
Remove transactions feature flag (#3557)
* Update schema, remove transaction specific files

* Merge `.transaction` queries and mutations into regular files

* Merge OrderDetails fragments

* Remove usage of `.transaction` graphl types

* Update fixtures

* Remove usage of useFlag, remove duplicated queries & mutations

* Fix displayed event type for INFO

* Remove type alias from order/types.ts, remove type casting

* Fix failing tests

* Add preview label and better description in Channel settings

* Update button in GrantRefund page

* Fix missing data-test-id

* Extract messages

* Visual fixes

* Revert changes to generated files

* Revert changes to generated files

* Fix psp reference hover

* Fix colors on manu refunds screen

* Revert "Fix colors on manu refunds screen"

This reverts commit 02302930ab502a4fdc3c71558532a2d74f2e32c9.

---------

Co-authored-by: andrzejewsky <vox3r69@gmail.com>
Co-authored-by: Michal Miszczyszyn <michal@mmiszy.pl>
2023-04-28 13:24:10 +02:00

34 lines
983 B
TypeScript

import { order } from "@dashboard/orders/fixtures";
import Wrapper from "@test/wrapper";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import React from "react";
import OrderAddTransaction from "./OrderAddTransaction";
describe("OrderAddTransaction", () => {
it("renders skeleton when order is loading", () => {
render(
<OrderAddTransaction
order={undefined}
onAddTransaction={() => undefined}
/>,
);
expect(screen.queryByRole("button")).not.toBeInTheDocument();
});
it("calls onAddTransaction when clicked", async () => {
const callback = jest.fn();
render(
<Wrapper>
<OrderAddTransaction order={order(null)} onAddTransaction={callback} />
</Wrapper>,
);
const button = await screen.findByRole("button");
expect(button).toBeInTheDocument();
await userEvent.click(button);
expect(callback).toHaveBeenCalled();
});
});