diff --git a/test/unit/components/SideBar/Sidebar.spec.js b/test/unit/components/SideBar/Sidebar.spec.js
index 1a0878dfeb..89a2cc428e 100644
--- a/test/unit/components/SideBar/Sidebar.spec.js
+++ b/test/unit/components/SideBar/Sidebar.spec.js
@@ -136,21 +136,7 @@ const expectToHaveDefaultMenuLinks = async (user, params) => {
"/transactions",
"On-chain Transactions"
);
- await expectToHaveMenuLink(
- "menuLinkContent-governance",
- "Governance",
- "governanceIcon",
- "/governance",
- "Governance"
- );
if (!sidebarOnBottom || expandSideBar) {
- await expectToHaveMenuLink(
- "menuLinkContent-tickets",
- "Staking",
- "ticketsIcon",
- "/tickets",
- "Staking"
- );
await expectToHaveMenuLink(
"menuLinkContent-accounts",
"Accounts",
@@ -177,6 +163,20 @@ const expectToHaveDefaultMenuLinks = async (user, params) => {
"/dex",
"DEX"
);
+ await expectToHaveMenuLink(
+ "menuLinkContent-tickets",
+ "Staking",
+ "ticketsIcon",
+ "/tickets",
+ "Staking"
+ );
+ await expectToHaveMenuLink(
+ "menuLinkContent-governance",
+ "Governance",
+ "governanceIcon",
+ "/governance",
+ "Governance"
+ );
}
}
if (isLnEnabled) {
@@ -301,7 +301,9 @@ test("renders sidebar on the bottom", async () => {
mockSidebarOnBottom.mockRestore();
});
-test("renders sidebar with trezor enabled, should not find trezor menu, it have been moved to a separate tab under settings", async () => {
+test("renders sidebar with trezor enabled, should not find trezor menu,\
+ it have been moved to a separate tab under settings. Governance and Tickets\
+ should be hidden.", async () => {
const mockIsTrezor = (selectors.isTrezor = jest.fn(() => true));
const { user } = render();
await expectToHaveDefaultMenuLinks(user, {
diff --git a/test/unit/components/Snackbar/Snackbar.spec.js b/test/unit/components/Snackbar/Snackbar.spec.js
index 94d22d75e4..c9933716a5 100644
--- a/test/unit/components/Snackbar/Snackbar.spec.js
+++ b/test/unit/components/Snackbar/Snackbar.spec.js
@@ -184,22 +184,23 @@ test("test multi notification", async () => {
jest.useFakeTimers();
user.click(snackbarSenderButton);
user.click(snackbarSenderButton);
+ user.click(snackbarSenderButton);
await waitFor(() =>
- expect(screen.getAllByTestId("snackbar-message").length).toBe(2)
+ expect(screen.getAllByTestId("snackbar-message").length).toBe(3)
);
// simulate that 10 * 500 seconds have passed
act(() => {
jest.advanceTimersByTime(5000);
});
await waitFor(() =>
- expect(screen.getAllByTestId("snackbar-message").length).toBe(1)
+ expect(screen.getAllByTestId("snackbar-message").length).toBe(2)
);
// simulate that 10 * 500 seconds have passed
act(() => {
jest.advanceTimersByTime(5000);
});
await waitFor(() =>
- expect(screen.queryByTestId("snackbar-message")).not.toBeInTheDocument()
+ expect(screen.getAllByTestId("snackbar-message").length).toBe(1)
);
});
diff --git a/test/unit/components/views/GetStaredPage/SetupWallet/ProcessManagedTickets.spec.js b/test/unit/components/views/GetStaredPage/SetupWallet/ProcessManagedTickets.spec.js
index 852fa3e84e..89b95efa3c 100644
--- a/test/unit/components/views/GetStaredPage/SetupWallet/ProcessManagedTickets.spec.js
+++ b/test/unit/components/views/GetStaredPage/SetupWallet/ProcessManagedTickets.spec.js
@@ -1,7 +1,6 @@
import ProcessManagedTickets from "components/views/GetStartedPage/SetupWallet/ProcessManagedTickets";
import { render } from "test-utils.js";
-import { screen, wait } from "@testing-library/react";
-import user from "@testing-library/user-event";
+import { screen, waitFor } from "@testing-library/react";
import * as sel from "selectors";
import * as wal from "wallet";
import * as arrs from "../../../../../../app/helpers/arrays";
@@ -108,37 +107,40 @@ const initialState = {
}
};
-test("skip ProcessManagedTickets and show error", () => {
- render(
+test("skip ProcessManagedTickets and show error", async () => {
+ const { user } = render(
);
- user.click(getSkipButton());
+ await user.click(getSkipButton());
expect(screen.getByText(testError)).toBeInTheDocument();
expect(mockCancel).toHaveBeenCalled();
});
test("do ProcessManagedTickets - in a private wallet", async () => {
mockUnlockLockAndGetAccountsAttempt();
- render(, {
- initialState
- });
+ const { user } = render(
+ ,
+ {
+ initialState
+ }
+ );
const continueButton = getContinueButton();
- user.click(continueButton);
+ await user.click(continueButton);
expect(screen.getByText("Passphrase")).toBeInTheDocument();
// cancel first
- user.click(getCancelButton());
+ await user.click(getCancelButton());
- user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.click(continueButton);
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockProcessManagedTickets).toHaveBeenNthCalledWith(
1,
@@ -201,22 +203,25 @@ test("do ProcessManagedTickets - in a default wallet, available vps pubkeys have
selectors.getMixedAccount = jest.fn(() => null);
selectors.getChangeAccount = jest.fn(() => null);
mockUnlockLockAndGetAccountsAttempt();
- render(, {
- initialState
- });
+ const { user } = render(
+ ,
+ {
+ initialState
+ }
+ );
const continueButton = getContinueButton();
- user.click(continueButton);
+ await user.click(continueButton);
expect(screen.getByText("Passphrase")).toBeInTheDocument();
// cancel first
- user.click(getCancelButton());
+ await user.click(getCancelButton());
- user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.click(continueButton);
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockProcessManagedTickets).toHaveBeenNthCalledWith(
1,
@@ -279,22 +284,25 @@ test("do ProcessManagedTickets - in a default wallet, available vps pubkeys have
selectors.getMixedAccount = jest.fn(() => null);
selectors.getChangeAccount = jest.fn(() => null);
mockUnlockLockAndGetAccountsAttempt();
- render(, {
- initialState
- });
+ const { user } = render(
+ ,
+ {
+ initialState
+ }
+ );
const continueButton = getContinueButton();
- user.click(continueButton);
+ await user.click(continueButton);
expect(screen.getByText("Passphrase")).toBeInTheDocument();
// cancel first
- user.click(getCancelButton());
+ await user.click(getCancelButton());
- user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.click(continueButton);
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockProcessManagedTickets).toHaveBeenNthCalledWith(
1,
@@ -355,16 +363,19 @@ test("do ProcessManagedTickets - failed to fetch vsps", async () => {
mockGetAllVSPs = wallet.getAllVSPs = jest.fn(() => {
throw testError;
});
- render(, {
- initialState
- });
+ const { user } = render(
+ ,
+ {
+ initialState
+ }
+ );
const continueButton = getContinueButton();
- user.click(continueButton);
+ await user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockGetAllVSPs).toHaveBeenCalled();
expect(mockProcessManagedTickets).not.toHaveBeenCalled();
diff --git a/test/unit/components/views/GetStaredPage/SetupWallet/ProcessUnmanagedTickets.spec.js b/test/unit/components/views/GetStaredPage/SetupWallet/ProcessUnmanagedTickets.spec.js
index 791647422a..408f0283ff 100644
--- a/test/unit/components/views/GetStaredPage/SetupWallet/ProcessUnmanagedTickets.spec.js
+++ b/test/unit/components/views/GetStaredPage/SetupWallet/ProcessUnmanagedTickets.spec.js
@@ -1,7 +1,6 @@
import ProcessUnmanagedTickets from "components/views/GetStartedPage/SetupWallet/ProcessUnmanagedTickets";
import { render } from "test-utils.js";
-import { screen, wait } from "@testing-library/react";
-import user from "@testing-library/user-event";
+import { screen, waitFor } from "@testing-library/react";
import * as sel from "selectors";
import * as wal from "wallet";
import * as arrs from "../../../../../../app/helpers/arrays";
@@ -123,8 +122,8 @@ const initialState = {
}
};
-test("skip ProcessUnmanagedTickets and show error", () => {
- render(
+test("skip ProcessUnmanagedTickets and show error", async () => {
+ const { user } = render(
{
/>
);
expect(screen.getByText(testError)).toBeInTheDocument();
- user.click(getSkipButton());
+ await user.click(getSkipButton());
expect(mockCancel).toHaveBeenCalled();
});
test("do ProcessUnmanagedTickets - in a private wallet", async () => {
mockUnlockLockAndGetAccountsAttempt();
- render(, {
- initialState
- });
+ const { user } = render(
+ ,
+ {
+ initialState
+ }
+ );
const continueButton = getContinueButton();
expect(continueButton.disabled).toBe(true);
- user.click(screen.getByText("Select VSP..."));
- user.click(screen.getByText(mockAvailableMainnetVsps[0].host));
+ await user.click(screen.getByText("Select VSP..."));
+ await user.click(screen.getByText(mockAvailableMainnetVsps[0].host));
expect(screen.getByText("Loading")).toBeInTheDocument();
- await wait(() => expect(getContinueButton().disabled).toBeFalsy());
+ await waitFor(() => expect(getContinueButton().disabled).toBeFalsy());
expect(screen.queryByText("Loading")).not.toBeInTheDocument();
expect(
screen.getByText(mockAvailableMainnetVsps[0].host)
).toBeInTheDocument();
- user.click(continueButton);
+ await user.click(continueButton);
expect(screen.getByText("Passphrase")).toBeInTheDocument();
// cancel first
- user.click(getCancelButton());
+ await user.click(getCancelButton());
- user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.click(continueButton);
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockProcessUnmanagedTickets).toHaveBeenCalledWith(
testWalletService,
@@ -202,32 +204,35 @@ test("do ProcessUnmanagedTickets - in a default wallet", async () => {
selectors.getMixedAccount = jest.fn(() => null);
selectors.getChangeAccount = jest.fn(() => null);
mockUnlockLockAndGetAccountsAttempt();
- render(, {
- initialState
- });
+ const { user } = render(
+ ,
+ {
+ initialState
+ }
+ );
const continueButton = getContinueButton();
expect(continueButton.disabled).toBe(true);
- user.click(screen.getByText("Select VSP..."));
- user.click(screen.getByText(mockAvailableMainnetVsps[0].host));
+ await user.click(screen.getByText("Select VSP..."));
+ await user.click(screen.getByText(mockAvailableMainnetVsps[0].host));
expect(screen.getByText("Loading")).toBeInTheDocument();
- await wait(() => expect(getContinueButton().disabled).toBeFalsy());
+ await waitFor(() => expect(getContinueButton().disabled).toBeFalsy());
expect(screen.queryByText("Loading")).not.toBeInTheDocument();
expect(
screen.getByText(mockAvailableMainnetVsps[0].host)
).toBeInTheDocument();
- user.click(continueButton);
+ await user.click(continueButton);
expect(screen.getByText("Passphrase")).toBeInTheDocument();
// cancel first
- user.click(getCancelButton());
+ await user.click(getCancelButton());
- user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.click(continueButton);
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockProcessUnmanagedTickets).toHaveBeenCalledWith(
testWalletService,
@@ -264,40 +269,42 @@ test("do ProcessUnmanagedTickets - in a default wallet", async () => {
test("do ProcessUnmanagedTickets - vsp listing is not enabled", async () => {
mockUnlockLockAndGetAccountsAttempt();
- render(, {
- initialState: cloneDeep({
- ...initialState,
- settings: {
- ...initialState.settings,
- tempSettings: {
- ...initialState.settings.tempSettings,
- allowedExternalRequests: []
+ const { user } = render(
+ ,
+ {
+ initialState: cloneDeep({
+ ...initialState,
+ settings: {
+ ...initialState.settings,
+ tempSettings: {
+ ...initialState.settings.tempSettings,
+ allowedExternalRequests: []
+ }
}
- }
- })
- });
+ })
+ }
+ );
const continueButton = getContinueButton();
expect(continueButton.disabled).toBe(true);
- user.type(screen.getByRole("combobox"), testCustomVspHost);
- user.click(screen.getByText(`Create "${testCustomVspHost}"`));
- expect(screen.getByText("Loading")).toBeInTheDocument();
- await wait(() =>
+ await user.type(screen.getByRole("combobox"), testCustomVspHost);
+ await user.click(screen.getByText(`Create "${testCustomVspHost}"`));
+ await waitFor(() =>
expect(screen.getByText(testCustomVspHost)).toBeInTheDocument()
);
- user.click(continueButton);
+ await user.click(continueButton);
expect(screen.getByText("Passphrase")).toBeInTheDocument();
// cancel first
- user.click(getCancelButton());
+ await user.click(getCancelButton());
- user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.click(continueButton);
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockProcessUnmanagedTickets).toHaveBeenCalledWith(
testWalletService,
@@ -339,29 +346,32 @@ test("do ProcessUnManagedTickets - failed", async () => {
}
);
mockUnlockLockAndGetAccountsAttempt();
- render(, {
- initialState
- });
+ const { user } = render(
+ ,
+ {
+ initialState
+ }
+ );
const continueButton = getContinueButton();
expect(continueButton.disabled).toBe(true);
- user.click(screen.getByText("Select VSP..."));
- user.click(screen.getByText(mockAvailableMainnetVsps[0].host));
- expect(screen.getByText("Loading")).toBeInTheDocument();
- await wait(() => expect(getContinueButton().disabled).toBeFalsy());
+ await user.click(screen.getByText("Select VSP..."));
+ await user.click(screen.getByText(mockAvailableMainnetVsps[0].host));
+ await waitFor(() => screen.getByText("Loading"));
+ await waitFor(() => expect(getContinueButton().disabled).toBeFalsy());
expect(screen.queryByText("Loading")).not.toBeInTheDocument();
expect(
screen.getByText(mockAvailableMainnetVsps[0].host)
).toBeInTheDocument();
- user.click(continueButton);
+ await user.click(continueButton);
expect(screen.getByText("Passphrase")).toBeInTheDocument();
- user.click(continueButton);
- user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
- user.click(getModalContinueButton());
+ await user.click(continueButton);
+ await user.type(screen.getByLabelText("Private Passphrase"), testPassphrase);
+ await user.click(getModalContinueButton());
- await wait(() => expect(mockSend).toHaveBeenCalled());
+ await waitFor(() => expect(mockSend).toHaveBeenCalled());
expect(mockProcessUnmanagedTickets).toHaveBeenCalledWith(
testWalletService,
diff --git a/test/unit/components/views/LNPage/OverviewTab.spec.js b/test/unit/components/views/LNPage/OverviewTab.spec.js
index d723f9dd23..efbef74816 100644
--- a/test/unit/components/views/LNPage/OverviewTab.spec.js
+++ b/test/unit/components/views/LNPage/OverviewTab.spec.js
@@ -1,6 +1,6 @@
import { OverviewTab } from "components/views/LNPage/OverviewTab";
import { render } from "test-utils.js";
-import { screen, waitFor } from "@testing-library/react";
+import { fireEvent, screen, waitFor } from "@testing-library/react";
import { DCR } from "constants";
import * as sel from "selectors";
import * as lna from "actions/LNActions";
@@ -111,7 +111,7 @@ test("test recent activity list", async () => {
await user.click(screen.getByText("Channel Funding"));
expect(screen.getByText("Channel Created")).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "Close Channel" }));
- await user.click(screen.getByText("Confirm"));
+ fireEvent.click(screen.getByText("Confirm"));
await waitFor(() =>
expect(mockCloseChannel).toHaveBeenCalledWith(
diff --git a/test/unit/components/views/TransactionsPage/SendTab/SendTab.spec.js b/test/unit/components/views/TransactionsPage/SendTab/SendTab.spec.js
index c111e3f6cb..9aba73c6f7 100644
--- a/test/unit/components/views/TransactionsPage/SendTab/SendTab.spec.js
+++ b/test/unit/components/views/TransactionsPage/SendTab/SendTab.spec.js
@@ -10,6 +10,8 @@ import { DCR } from "constants";
import { fireEvent } from "@testing-library/react";
jest.mock("electron");
export const GETNEXTADDRESS_SUCCESS = "GETNEXTADDRESS_SUCCESS";
+import debouce from "lodash/debounce";
+jest.mock("lodash/debounce");
const mockMixedAccountValue = 6;
const validAmount = 12;
@@ -102,6 +104,7 @@ const transactionActions = ta;
const wallet = wl;
beforeEach(() => {
+ debouce.mockImplementation((fn) => fn);
mockIsTestNet = selectors.isTestNet = jest.fn(() => false);
mockIsMainNet = selectors.isMainNet = jest.fn(() => false);
mockWalletService = selectors.walletService = jest.fn(() => {
@@ -275,7 +278,7 @@ test("test amount input", async () => {
// click on send all amount button
await user.click(sendAllButton);
expect(queryAmountInput()).not.toBeInTheDocument();
- await wait(() =>
+ await waitFor(() =>
expect(screen.getByText("Amount").nextElementSibling.textContent).toBe(
`${mockMixedAccount.spendableAndUnit}100% of Account Balance`
)
@@ -320,21 +323,39 @@ test("test amount input", async () => {
// type arbitrary amount and check the percent value
amountInput = getAmountInput();
- await user.type(amountInput, "12");
- expect(screen.getByText(/4.80% of account balance/i)).toBeInTheDocument();
+ fireEvent.change(amountInput, {
+ target: { value: "12" }
+ });
+ await waitFor(() =>
+ expect(screen.getByText(/4.80% of account balance/i)).toBeInTheDocument()
+ );
// clear amountInput, should get error msg
- await user.clear(amountInput);
- expect(screen.getByText(/This field is required/i)).toBeInTheDocument();
+ fireEvent.change(amountInput, {
+ target: { value: "" }
+ });
+
+ await waitFor(() =>
+ expect(screen.getByText(/This field is required/i)).toBeInTheDocument()
+ );
// retype validAmount
- await user.type(amountInput, `${validAmount}`);
- expect(screen.queryByText(/This field is required/i)).not.toBeInTheDocument();
+ fireEvent.change(amountInput, {
+ target: { value: `${validAmount}` }
+ });
+ await waitFor(() =>
+ expect(
+ screen.queryByText(/This field is required/i)
+ ).not.toBeInTheDocument()
+ );
// type more than 100% amount
- await user.clear(amountInput);
- await user.type(amountInput, "234232");
- expect(screen.getByText(/>100% of account balance/i)).toBeInTheDocument();
+ fireEvent.change(amountInput, {
+ target: { value: "234232" }
+ });
+ await waitFor(() =>
+ expect(screen.getByText(/>100% of account balance/i)).toBeInTheDocument()
+ );
});
test("test `send to` input", async () => {
@@ -367,7 +388,7 @@ test("test `send to` input", async () => {
await waitFor(() => expect(sendToInput.value).toBe(mockValidAddress));
expect(screen.queryByText(expectedErrorMsg)).not.toBeInTheDocument();
- await wait(() =>
+ await waitFor(() =>
expect(mockConstructTransactionAttempt).toHaveBeenCalledWith(
mockMixedAccountValue,
0,
@@ -417,18 +438,21 @@ test("test paste button (paste address with trailing and leading spaces)", async
});
test("type address with trailing and leading spaces", async () => {
- const { user } = render();
+ render();
const sendToInput = getSendToInput();
const amountInput = getAmountInput();
- await user.type(amountInput, `${validAmount}`);
+ fireEvent.change(amountInput, {
+ target: { value: `${validAmount}` }
+ });
// test paste button
const mockPastedAddress = "mockPastedAddress";
// type address with trailing and leading spaces
- await user.clear(sendToInput);
- await user.type(sendToInput, ` ${mockPastedAddress} `);
+ fireEvent.change(sendToInput, {
+ target: { value: ` ${mockPastedAddress} ` }
+ });
await waitFor(() => expect(sendToInput.value).toBe(mockPastedAddress));
});
@@ -474,20 +498,23 @@ test("`Sending from unmixed account` is allowed", async () => {
expect(screen.getByText(mockDefaultAccount.name)).toBeInTheDocument();
expect(screen.getByText(mockAccount2.name)).toBeInTheDocument();
expect(screen.getAllByText(mockMixedAccount.name).length).toBe(2);
- await user.click(screen.getByText(mockEmptyAccount.name));
- await waitFor(() =>
- expect(screen.getAllByText(mockEmptyAccount.name).length).toBe(1)
- );
+ fireEvent.click(screen.getByText(mockEmptyAccount.name));
+ expect(screen.queryByText(mockMixedAccount.name)).not.toBeInTheDocument();
// valid amount but the source account is empty
const amountInput = getAmountInput();
- await user.type(amountInput, `${validAmount}`);
+ fireEvent.change(amountInput, {
+ target: { value: `${validAmount}` }
+ });
+ await waitFor(() => expect(amountInput.value).toBe(`${validAmount}`));
// changing account while sending all mode is on
// should change the amount accordingly click on send all amount button
await user.click(getSendAllButton());
- expect(screen.getByText("Amount").nextElementSibling.textContent).toBe(
- `${mockEmptyAccount.spendableAndUnit}100% of Account Balance`
+ await waitFor(() =>
+ expect(screen.getByText("Amount").nextElementSibling.textContent).toBe(
+ `${mockEmptyAccount.spendableAndUnit}100% of Account Balance`
+ )
);
await user.click(screen.getByText(mockEmptyAccount.name));
await user.click(screen.getByText(mockAccount2.name));
@@ -501,7 +528,12 @@ test("`Sending from unmixed account` is allowed", async () => {
const fillOutputForm = async (user, index) => {
const amountInput = getAllAmountInput()[index];
const sendToInput = getAllSendToInput()[index];
- await user.type(amountInput, `${mockOutputs[index].amount}`);
+ fireEvent.change(amountInput, {
+ target: { value: `${mockOutputs[index].amount}` }
+ });
+ await waitFor(() =>
+ expect(amountInput.value).toBe(`${mockOutputs[index].amount}`)
+ );
fireEvent.change(sendToInput, {
target: { value: mockOutputs[index].address }
});
@@ -568,7 +600,9 @@ test("send funds to another account", async () => {
const sendSelfButton = getSendSelfButton();
- await user.type(getAmountInput(), `${validAmount}`);
+ fireEvent.change(getAmountInput(), {
+ target: { value: `${validAmount}` }
+ });
await user.click(sendSelfButton);
await user.click(screen.getAllByRole("combobox")[1]);
selectors.nextAddressAccount = jest.fn(() => mockAccount2);
@@ -577,7 +611,7 @@ test("send funds to another account", async () => {
await waitFor(() =>
expect(screen.queryByText(mockDefaultAccount.name)).not.toBeInTheDocument()
);
- await wait(() =>
+ await waitFor(() =>
expect(mockConstructTransactionAttempt).toHaveBeenCalledWith(
mockMixedAccountValue,
0,
@@ -585,6 +619,9 @@ test("send funds to another account", async () => {
undefined
)
);
+ await waitFor(() =>
+ expect(screen.queryByText(mockDefaultAccount.name)).not.toBeInTheDocument()
+ );
expect(mockGetNextAddressAttempt).toHaveBeenCalled();
// switch back from send to self mode