Skip to content

Commit

Permalink
fix: corrupted Success text
Browse files Browse the repository at this point in the history
  • Loading branch information
dianasavvatina committed Feb 6, 2025
1 parent 7096b2f commit 300957f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
42 changes: 42 additions & 0 deletions apps/web/src/components/SendFlow/SuccessStep.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { SuccessStep } from "./SuccessStep"; // Adjust path if needed
import { renderInModal, screen } from "../../testUtils";

describe("<SuccessStep />", () => {
it("renders success message when there is no dAppNotificationError", async () => {
await renderInModal(<SuccessStep hash="testHash" />);

expect(screen.getByTestId("success-text")).toHaveTextContent(
"You can follow this operation's progress in the Operations section. It may take up to 30 seconds to appear."
);
expect(screen.queryByTestId("success-no-notify-text")).not.toBeInTheDocument();
expect(screen.queryByTestId("do-not-retry-text")).not.toBeInTheDocument();
expect(screen.queryByTestId("dapp-noticaition-error")).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: "See all Operations" })).toBeInTheDocument();
expect(screen.getByRole("link", { name: "View in TzKT" })).toHaveAttribute(
"href",
"https://tzkt.io/testHash"
);
});

it("renders warning message when dAppNotificationError is present", async () => {
await renderInModal(<SuccessStep dAppNotificationError="testError" hash="testHash" />);

expect(screen.getByTestId("success-no-notify-text")).toHaveTextContent(
"Transaction was performed successfully and stored on the blockchain. However, the dApp was not notified."
);
expect(screen.getByTestId("do-not-retry-text")).toHaveTextContent(
"Do not retry this operation — it has already been completed. You may need to reload the dApp page to see the updated status."
);
expect(screen.getByTestId("dapp-noticaition-error")).toHaveTextContent(
"Error on dApp notification: testError"
);
expect(screen.getByTestId("success-text")).toHaveTextContent(
"You can follow this operation's progress in the Operations section. It may take up to 30 seconds to appear."
);
expect(screen.getByRole("button", { name: "See all Operations" })).toBeInTheDocument();
expect(screen.getByRole("link", { name: "View in TzKT" })).toHaveAttribute(
"href",
"https://tzkt.io/testHash"
);
});
});
14 changes: 9 additions & 5 deletions apps/web/src/components/SendFlow/SuccessStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,28 @@ export const SuccessStep = ({
if (dAppNotificationError) {
return (
<>
<Text size="md">
<Text data-testid="success-no-notify-text" size="md">
Transaction was performed successfully and stored on the blockchain. However, the dApp
was not notified.
</Text>
<Text marginTop="12px" size="md">
<Text marginTop="12px" data-testid="do-not-retry-text" size="md">
<strong>Do not retry this operation</strong> — it has already been completed. You may
need to reload the dApp page to see the updated status.
</Text>
<Text marginTop="12px" size="md">
<Text marginTop="12px" data-testid="dapp-noticaition-error" size="md">
<strong>Error on dApp notification:</strong> {dAppNotificationError}
</Text>
<Text marginTop="12px" size="md">
<Text marginTop="12px" data-testid="success-text" size="md">
{successText}
</Text>
</>
);
} else {
return <Text size="md">successText</Text>;
return (
<Text data-testid="success-text" size="md">
{successText}
</Text>
);
}
};

Expand Down

1 comment on commit 300957f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title Lines Statements Branches Functions
apps/desktop Coverage: 83%
83.74% (1788/2135) 79.43% (850/1070) 78.27% (454/580)
apps/web Coverage: 83%
83.74% (1788/2135) 79.43% (850/1070) 78.27% (454/580)
packages/components Coverage: 97%
97.51% (196/201) 95.91% (94/98) 88.13% (52/59)
packages/core Coverage: 81%
82.37% (215/261) 72.51% (95/131) 81.66% (49/60)
packages/crypto Coverage: 100%
100% (43/43) 90.9% (10/11) 100% (7/7)
packages/data-polling Coverage: 96%
94.66% (142/150) 87.5% (21/24) 92.85% (39/42)
packages/multisig Coverage: 98%
98.47% (129/131) 85.71% (18/21) 100% (36/36)
packages/social-auth Coverage: 95%
95.45% (21/22) 91.66% (11/12) 100% (3/3)
packages/state Coverage: 83%
83.21% (833/1001) 79.58% (191/240) 76.7% (303/395)
packages/tezos Coverage: 89%
88.72% (118/133) 94.59% (35/37) 86.84% (33/38)
packages/tzkt Coverage: 89%
87.32% (62/71) 87.5% (14/16) 80.48% (33/41)

Please sign in to comment.