Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

chore: rename selectAsset variations to selectNetworkInput #2639

Merged
merged 1 commit into from Aug 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/domains/contact/components/ContactForm/ContactForm.test.tsx
Expand Up @@ -55,16 +55,16 @@ describe("ContactForm", () => {
it("should select network", () => {
const { getByTestId } = render(<ContactForm networks={networks} onCancel={onCancel} onSave={onSave} />);

const input = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
act(() => {
fireEvent.change(input, { target: { value: "Bitco" } });
fireEvent.change(selectNetworkInput, { target: { value: "Bitco" } });
});

act(() => {
fireEvent.keyDown(input, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

expect(input).toHaveValue("Bitcoin");
expect(selectNetworkInput).toHaveValue("Bitcoin");
});

it("should add an address", async () => {
Expand All @@ -74,7 +74,7 @@ describe("ContactForm", () => {

expect(() => getAllByTestId("contact-form__address-list-item")).toThrow(/Unable to find an element by/);

const assetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

await act(async () => {
await fireEvent.change(getByTestId("contact-form__address-input"), {
Expand All @@ -85,9 +85,9 @@ describe("ContactForm", () => {
target: { value: "name" },
});

fireEvent.change(assetInput, { target: { value: "Bitco" } });
fireEvent.change(selectNetworkInput, { target: { value: "Bitco" } });

fireEvent.keyDown(assetInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });

await waitFor(() => {
expect(queryByTestId("contact-form__add-address-btn")).not.toBeDisabled();
Expand Down Expand Up @@ -129,7 +129,7 @@ describe("ContactForm", () => {
<ContactForm networks={networks} onCancel={onCancel} onSave={fn} />,
);

const assetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

await act(async () => {
await fireEvent.change(getByTestId("contact-form__address-input"), {
Expand All @@ -140,9 +140,9 @@ describe("ContactForm", () => {
target: { value: "name" },
});

fireEvent.change(assetInput, { target: { value: "Bitco" } });
fireEvent.change(selectNetworkInput, { target: { value: "Bitco" } });

fireEvent.keyDown(assetInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });

await waitFor(() => {
expect(queryByTestId("contact-form__add-address-btn")).not.toBeDisabled();
Expand Down
Expand Up @@ -42,7 +42,7 @@ describe("CreateContact", () => {
expect(getByTestId("modal__inner")).toHaveTextContent(translations.MODAL_CREATE_CONTACT.TITLE);
expect(getByTestId("modal__inner")).toHaveTextContent(translations.MODAL_CREATE_CONTACT.DESCRIPTION);

const assetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

await act(async () => {
await fireEvent.change(getByTestId("contact-form__address-input"), {
Expand All @@ -53,9 +53,9 @@ describe("CreateContact", () => {
target: { value: existingContact.name() },
});

fireEvent.change(assetInput, { target: { value: "Ark Devnet" } });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Devnet" } });

fireEvent.keyDown(assetInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });

await waitFor(() => {
expect(queryByTestId("contact-form__add-address-btn")).not.toBeDisabled();
Expand Down
Expand Up @@ -91,16 +91,16 @@ describe("UpdateContact", () => {
);

const saveButton = getByTestId("contact-form__save-btn");
const assetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

// Add network
await act(async () => {
await fireEvent.change(getByTestId("contact-form__address-input"), {
target: { value: newAddress.address },
});

fireEvent.change(assetInput, { target: { value: "Ark Devnet" } });
fireEvent.keyDown(assetInput, { key: "Enter", code: 13 });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Devnet" } });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

await waitFor(() => {
Expand Down Expand Up @@ -177,16 +177,16 @@ describe("UpdateContact", () => {

expect(nameInput).toHaveValue(newName);
const saveButton = getByTestId("contact-form__save-btn");
const assetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

// Add network
await act(async () => {
await fireEvent.change(getByTestId("contact-form__address-input"), {
target: { value: newAddress.address },
});

fireEvent.change(assetInput, { target: { value: "Ark Devnet" } });
fireEvent.keyDown(assetInput, { key: "Enter", code: 13 });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Devnet" } });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

await waitFor(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/domains/contact/pages/Contacts/Contacts.test.tsx
Expand Up @@ -52,7 +52,7 @@ describe("Contacts", () => {
expect(getByTestId("contact-form__save-btn")).toBeDisabled();
expect(getByTestId("contact-form__add-address-btn")).toBeDisabled();

const assetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

expect(() => getAllByTestId("contact-form__address-list-item")).toThrow(/Unable to find an element by/);

Expand All @@ -65,11 +65,11 @@ describe("Contacts", () => {
target: { value: "name" },
});

fireEvent.change(assetInput, { target: { value: "Ark Devnet" } });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Devnet" } });
});

await act(async () => {
fireEvent.keyDown(assetInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

await waitFor(() => expect(queryByTestId("contact-form__add-address-btn")).not.toBeDisabled());
Expand Down
2 changes: 0 additions & 2 deletions src/domains/dashboard/pages/Dashboard/Dashboard.test.tsx
Expand Up @@ -27,8 +27,6 @@ beforeEach(() => {
.persist();
});

// afterEach(() => nock.cleanAll());

describe("Dashboard", () => {
it("should render", async () => {
const { asFragment, getByTestId, getAllByTestId } = renderWithRouter(
Expand Down
20 changes: 10 additions & 10 deletions src/domains/vote/pages/Votes/Votes.test.tsx
Expand Up @@ -37,32 +37,32 @@ describe("Votes", () => {

it("should select a network", () => {
const { container, asFragment, getByTestId } = renderPage();
const selectAssetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

act(() => {
fireEvent.change(selectAssetInput, { target: { value: "Bitco" } });
fireEvent.change(selectNetworkInput, { target: { value: "Bitco" } });
});

act(() => {
fireEvent.keyDown(selectAssetInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

expect(container).toBeTruthy();
expect(selectAssetInput).toHaveValue("Bitcoin");
expect(selectNetworkInput).toHaveValue("Bitcoin");
expect(getByTestId("AddressList")).toBeTruthy();
expect(asFragment()).toMatchSnapshot();
});

it("should select address", () => {
const { asFragment, getByTestId, getAllByTestId } = renderPage();
const selectAssetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

act(() => {
fireEvent.change(selectAssetInput, { target: { value: "Bitco" } });
fireEvent.change(selectNetworkInput, { target: { value: "Bitco" } });
});

act(() => {
fireEvent.keyDown(selectAssetInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

expect(getByTestId("AddressList")).toBeTruthy();
Expand All @@ -79,14 +79,14 @@ describe("Votes", () => {

it("should select a delegate", () => {
const { asFragment, getByTestId, getAllByTestId } = renderPage();
const selectAssetInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");

act(() => {
fireEvent.change(selectAssetInput, { target: { value: "Bitco" } });
fireEvent.change(selectNetworkInput, { target: { value: "Bitco" } });
});

act(() => {
fireEvent.keyDown(selectAssetInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

expect(getByTestId("AddressList")).toBeTruthy();
Expand Down
32 changes: 16 additions & 16 deletions src/domains/wallet/pages/CreateWallet/CreateWallet.test.tsx
Expand Up @@ -61,22 +61,22 @@ describe("CreateWallet", () => {
expect(getByTestId("CreateWallet__first-step")).toBeTruthy();
expect(asFragment()).toMatchSnapshot();

const selectAssetsInput = getByTestId("SelectNetworkInput__input");
expect(selectAssetsInput).toBeTruthy();
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
expect(selectNetworkInput).toBeTruthy();

act(() => {
fireEvent.change(selectAssetsInput, { target: { value: "Ark Dev" } });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Dev" } });
});

act(() => {
fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

expect(selectAssetsInput).toHaveAttribute("disabled");
expect(selectNetworkInput).toHaveAttribute("disabled");

expect(selectAssetsInput).toHaveValue("Ark Devnet");
expect(selectNetworkInput).toHaveValue("Ark Devnet");

await waitFor(() => expect(selectAssetsInput).not.toHaveAttribute("disabled"));
await waitFor(() => expect(selectNetworkInput).not.toHaveAttribute("disabled"));
});

it("should render 2nd step", async () => {
Expand Down Expand Up @@ -217,24 +217,24 @@ describe("CreateWallet", () => {
await waitFor(() => expect(getByTestId("CreateWallet__first-step")).toBeTruthy());
expect(asFragment()).toMatchSnapshot();

const selectAssetsInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
const continueButton = getByTestId("CreateWallet__continue-button");
const backButton = getByTestId("CreateWallet__back-button");

act(() => {
fireEvent.change(selectAssetsInput, { target: { value: "Ark Dev" } });
fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Dev" } });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});
await waitFor(() => expect(continueButton).not.toHaveAttribute("disabled"));

act(() => {
fireEvent.change(selectAssetsInput, { target: { value: "" } });
fireEvent.change(selectNetworkInput, { target: { value: "" } });
});
await waitFor(() => expect(continueButton).toHaveAttribute("disabled"));

act(() => {
fireEvent.change(selectAssetsInput, { target: { value: "Ark Dev" } });
fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Dev" } });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});
await waitFor(() => expect(continueButton).not.toHaveAttribute("disabled"));
await waitFor(() => expect(profile.wallets().values().length).toBe(1));
Expand Down Expand Up @@ -357,13 +357,13 @@ describe("CreateWallet", () => {
);
await waitFor(() => expect(getByTestId("CreateWallet__first-step")).toBeTruthy());

const selectAssetsInput = getByTestId("SelectNetworkInput__input");
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
const continueButton = getByTestId("CreateWallet__continue-button");
expect(asFragment()).toMatchSnapshot();

act(() => {
fireEvent.change(selectAssetsInput, { target: { value: "Ark Dev" } });
fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
fireEvent.change(selectNetworkInput, { target: { value: "Ark Dev" } });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});
await waitFor(() => expect(continueButton).not.toHaveAttribute("disabled"));

Expand Down
50 changes: 25 additions & 25 deletions src/domains/wallet/pages/ImportWallet/ImportWallet.test.tsx
Expand Up @@ -60,18 +60,18 @@ describe("ImportWallet", () => {
expect(getByTestId("ImportWallet__first-step")).toBeTruthy();
expect(asFragment()).toMatchSnapshot();

const selectAssetsInput = getByTestId("SelectNetworkInput__input");
expect(selectAssetsInput).toBeTruthy();
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
expect(selectNetworkInput).toBeTruthy();

await act(async () => {
fireEvent.change(selectAssetsInput, { target: { value: "ARK D" } });
fireEvent.change(selectNetworkInput, { target: { value: "ARK D" } });
});

await act(async () => {
fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });
});

expect(selectAssetsInput).toHaveValue("Ark Devnet");
expect(selectNetworkInput).toHaveValue("Ark Devnet");
});

it("should render 2st step", async () => {
Expand Down Expand Up @@ -142,13 +142,13 @@ describe("ImportWallet", () => {
expect(asFragment()).toMatchSnapshot();

await actAsync(async () => {
const selectAssetsInput = getByTestId("SelectNetworkInput__input");
expect(selectAssetsInput).toBeTruthy();
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
expect(selectNetworkInput).toBeTruthy();

await fireEvent.change(selectAssetsInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
await fireEvent.change(selectNetworkInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });

expect(selectAssetsInput).toHaveValue("Ark Devnet");
expect(selectNetworkInput).toHaveValue("Ark Devnet");

const continueButton = getByTestId("ImportWallet__continue-button");
expect(continueButton).toBeTruthy();
Expand Down Expand Up @@ -192,13 +192,13 @@ describe("ImportWallet", () => {
expect(asFragment()).toMatchSnapshot();

await actAsync(async () => {
const selectAssetsInput = getByTestId("SelectNetworkInput__input");
expect(selectAssetsInput).toBeTruthy();
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
expect(selectNetworkInput).toBeTruthy();

await fireEvent.change(selectAssetsInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
await fireEvent.change(selectNetworkInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });

expect(selectAssetsInput).toHaveValue("Ark Devnet");
expect(selectNetworkInput).toHaveValue("Ark Devnet");

const continueButton = getByTestId("ImportWallet__continue-button");
expect(continueButton).toBeTruthy();
Expand Down Expand Up @@ -257,13 +257,13 @@ describe("ImportWallet", () => {
expect(asFragment()).toMatchSnapshot();

await actAsync(async () => {
const selectAssetsInput = getByTestId("SelectNetworkInput__input");
expect(selectAssetsInput).toBeTruthy();
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
expect(selectNetworkInput).toBeTruthy();

await fireEvent.change(selectAssetsInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
await fireEvent.change(selectNetworkInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });

expect(selectAssetsInput).toHaveValue("Ark Devnet");
expect(selectNetworkInput).toHaveValue("Ark Devnet");

const continueButton = getByTestId("ImportWallet__continue-button");
expect(continueButton).toBeTruthy();
Expand Down Expand Up @@ -325,13 +325,13 @@ describe("ImportWallet", () => {
expect(asFragment()).toMatchSnapshot();

await actAsync(async () => {
const selectAssetsInput = getByTestId("SelectNetworkInput__input");
expect(selectAssetsInput).toBeTruthy();
const selectNetworkInput = getByTestId("SelectNetworkInput__input");
expect(selectNetworkInput).toBeTruthy();

await fireEvent.change(selectAssetsInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectAssetsInput, { key: "Enter", code: 13 });
await fireEvent.change(selectNetworkInput, { target: { value: "ARK D" } });
await fireEvent.keyDown(selectNetworkInput, { key: "Enter", code: 13 });

expect(selectAssetsInput).toHaveValue("Ark Devnet");
expect(selectNetworkInput).toHaveValue("Ark Devnet");

const continueButton = getByTestId("ImportWallet__continue-button");
expect(continueButton).toBeTruthy();
Expand Down