Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/components/SettlementTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ describe("SettlementTable sorting", () => {
it("shows the amount and fee totals for the visible rows", () => {
render(<SettlementTable settlements={settlements} />);

const totalRow = document.querySelector("tfoot tr");
expect(totalRow).not.toBeNull();
expect(within(totalRow!).getAllByRole("cell").map((cell) => cell.textContent)).toEqual([
const totalRow = screen.getByRole("row", { name: /Total \(visible rows\)/ });
expect(within(totalRow).getAllByRole("cell").map((cell) => cell.textContent)).toEqual([
"Total (visible rows)",
"600",
"6",
Expand Down Expand Up @@ -261,15 +260,14 @@ describe("SettlementTable mobile layout", () => {
render(<SettlementTable settlements={settlements} />);
const cards = screen.getAllByTestId("settlement-card");
expect(cards).toHaveLength(settlements.length);
settlements.forEach((s) => {
const card = screen
.getByText(`Settlement #${s.id}`)
.closest('[data-testid="settlement-card"]');
settlements.forEach((s, index) => {
const card = cards[index];
expect(card).toBeInTheDocument();
expect(within(card!).getByText(s.anchor)).toBeInTheDocument();
expect(within(card!).getByText(s.asset)).toBeInTheDocument();
expect(within(card!).getByText(formatAmount(s.amount))).toBeInTheDocument();
expect(within(card!).getByText(formatAmount(s.fee))).toBeInTheDocument();
expect(within(card).getByRole("link", { name: `Settlement #${s.id}` })).toBeInTheDocument();
expect(within(card).getByText(s.anchor)).toBeInTheDocument();
expect(within(card).getByText(s.asset)).toBeInTheDocument();
expect(within(card).getByText(formatAmount(s.amount))).toBeInTheDocument();
expect(within(card).getByText(formatAmount(s.fee))).toBeInTheDocument();
});
});
});