Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not wait for finalization #561

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions src/ExtrinsicSubmissionResult.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ test("No result, error", () => {
expect(tree).toMatchSnapshot();
});

test("Non-finalized result, error", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isFinalized: false, status: {isFinalized: false}} as SignedTransaction} error={"error"} />);
test("In progress result, error", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isInBlock: false, status: {isInBlock: false}} as SignedTransaction} error={"error"} />);
expect(tree).toMatchSnapshot();
});

test("Non-finalized result, no error", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isFinalized: false, status: {type: "Ready", isFinalized: false}} as SignedTransaction} error={null} />);
test("In progress result, no error", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isInBlock: false, status: {type: "Ready", isInBlock: false}} as SignedTransaction} error={null} />);
expect(tree).toMatchSnapshot();
});

test("Finalized result, no error", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isFinalized: true, status: {isFinalized: true}} as SignedTransaction} error={null} />);
test("Done result, no error", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isInBlock: true, status: {isInBlock: true}} as SignedTransaction} error={null} />);
expect(tree).toMatchSnapshot();
});

test("Finalized result, no error, custom message", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isFinalized: true, status: {isFinalized: true}} as SignedTransaction} error={null} successMessage="Success" />);
test("Done result, no error, custom message", () => {
const tree = render(<ExtrinsicSubmissionResult result={{isInBlock: true, status: {isInBlock: true}} as SignedTransaction} error={null} successMessage="Success" />);
expect(tree).toMatchSnapshot();
});

Expand Down
20 changes: 10 additions & 10 deletions src/ExtrinsicSubmitter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe("ExtrinsicSubmitter", () => {
/>);

expect(screen.getByRole('generic')).toBeEmptyDOMElement();
expect(onSuccess).not.toBeCalled();
expect(onError).not.toBeCalled();
expect(onSuccess).not.toHaveBeenCalled();
expect(onError).not.toHaveBeenCalled();
});

it("is initially showing submitting", async () => {
Expand All @@ -39,8 +39,8 @@ describe("ExtrinsicSubmitter", () => {
/>);

await waitFor(() => expectSubmitting());
expect(onSuccess).not.toBeCalled();
expect(onError).not.toBeCalled();
expect(onSuccess).not.toHaveBeenCalled();
expect(onError).not.toHaveBeenCalled();
});

it("shows error and calls onError", async () => {
Expand All @@ -57,8 +57,8 @@ describe("ExtrinsicSubmitter", () => {
/>);

await waitFor(() => expect(screen.getByText("Submission failed: error")).toBeInTheDocument());
expect(onSuccess).not.toBeCalled();
expect(onError).toBeCalled();
expect(onSuccess).not.toHaveBeenCalled();
expect(onError).toHaveBeenCalled();
});

it("shows progress", async () => {
Expand All @@ -75,8 +75,8 @@ describe("ExtrinsicSubmitter", () => {
/>);

await waitFor(() => expect(screen.getByText("Current status: undefined")).toBeInTheDocument());
expect(onSuccess).not.toBeCalled();
expect(onError).not.toBeCalled();
expect(onSuccess).not.toHaveBeenCalled();
expect(onError).not.toHaveBeenCalled();
});

it("shows success and calls onSuccess", async () => {
Expand All @@ -93,8 +93,8 @@ describe("ExtrinsicSubmitter", () => {
/>);

await waitFor(() => expect(screen.getByText("Submission successful.")).toBeInTheDocument());
expect(onSuccess).toBeCalledWith("extrinsicId");
expect(onError).not.toBeCalled();
expect(onSuccess).toHaveBeenCalledWith("extrinsicId");
expect(onError).not.toHaveBeenCalled();
});
});

Expand Down
44 changes: 22 additions & 22 deletions src/__snapshots__/ExtrinsicSubmissionResult.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Finalized result, no error 1`] = `
exports[`Done result, no error 1`] = `
<div
className="ExtrinsicSubmissionResult"
>
Expand All @@ -20,7 +20,7 @@ exports[`Finalized result, no error 1`] = `
</div>
`;

exports[`Finalized result, no error, custom message 1`] = `
exports[`Done result, no error, custom message 1`] = `
<div
className="ExtrinsicSubmissionResult"
>
Expand All @@ -38,7 +38,7 @@ exports[`Finalized result, no error, custom message 1`] = `
</div>
`;

exports[`No result, error 1`] = `
exports[`In progress result, error 1`] = `
<div
className="ExtrinsicSubmissionResult"
>
Expand All @@ -58,45 +58,50 @@ exports[`No result, error 1`] = `
</div>
`;

exports[`No result, error, custom message 1`] = `
exports[`In progress result, no error 1`] = `
<div
className="ExtrinsicSubmissionResult"
>
<div
className="Alert danger"
className="Alert polkadot"
style={
Object {
"backgroundColor": undefined,
"color": "#e11a25",
"backgroundColor": "#e6007a",
"color": "white",
}
}
>
Error
<div
className="spinner-border"
/>
<p>
Current status: Ready
</p>
</div>
</div>
`;

exports[`No result, no error 1`] = `
exports[`No result, error 1`] = `
<div
className="ExtrinsicSubmissionResult"
>
<div
className="Alert polkadot"
className="Alert danger"
style={
Object {
"backgroundColor": "#e6007a",
"color": "white",
"backgroundColor": undefined,
"color": "#e11a25",
}
}
>
<p>
Submitting...
Submission failed: error
</p>
</div>
</div>
`;

exports[`Non-finalized result, error 1`] = `
exports[`No result, error, custom message 1`] = `
<div
className="ExtrinsicSubmissionResult"
>
Expand All @@ -109,14 +114,12 @@ exports[`Non-finalized result, error 1`] = `
}
}
>
<p>
Submission failed: error
</p>
Error
</div>
</div>
`;

exports[`Non-finalized result, no error 1`] = `
exports[`No result, no error 1`] = `
<div
className="ExtrinsicSubmissionResult"
>
Expand All @@ -129,11 +132,8 @@ exports[`Non-finalized result, no error 1`] = `
}
}
>
<div
className="spinner-border"
/>
<p>
Current status: Ready
Submitting...
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/common/PendingVaultTransferRequests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function PendingVaultTransferRequests() {
},
]}
data={ pendingRequests }
renderEmpty={ () => <EmptyTableMessage>No pending vault-out transfers</EmptyTableMessage> }
renderEmpty={ () => <EmptyTableMessage>No pending vault withdrawals</EmptyTableMessage> }
/>
<RequestToCancel
requestToCancel={ requestToCancel }
Expand Down
4 changes: 2 additions & 2 deletions src/common/RequestToCancel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default function RequestToCancel(props: Props) {
]}
size="lg"
>
<h2>Cancel vault-out transfer</h2>
<h2>Cancel vault withdrawal</h2>

<p>This will cancel the vault-out transfer. Your Legal Officer will be notified.</p>
<p>This will cancel the vault withdrawal. Your Legal Officer will be notified.</p>

<ExtrinsicSubmissionStateView />
</Dialog>
Expand Down
Loading
Loading