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

chore: test #769

Closed
wants to merge 20 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -835,15 +835,15 @@ exports[`Notifications > should open and close transaction details modal 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 1 DARK
Expand Down
15 changes: 14 additions & 1 deletion src/domains/dashboard/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { uniq } from "@ardenthq/sdk-helpers";
import { Contracts, DTO } from "@ardenthq/sdk-profiles";
import React, { useMemo, useState } from "react";
import React, {useEffect, useMemo, useState} from "react";

Check failure on line 3 in src/domains/dashboard/pages/Dashboard/Dashboard.tsx

View workflow job for this annotation

GitHub Actions / eslint (20.12.2)

'useEffect' is defined but never used. Allowed unused vars must match /_/u
import { useTranslation } from "react-i18next";
import { EmptyBlock } from "@/app/components/EmptyBlock";
import { useWalletFilters } from "@/domains/dashboard/components/FilterWallets";
Expand All @@ -16,6 +16,9 @@
import { useActiveProfile } from "@/app/hooks";
import { WelcomeModal } from "@/domains/profile/components/WelcomeModal";
import { TransactionDetailModal } from "@/domains/transaction/components/TransactionDetailModal";
import {generatePath} from "react-router";

Check failure on line 19 in src/domains/dashboard/pages/Dashboard/Dashboard.tsx

View workflow job for this annotation

GitHub Actions / eslint (20.12.2)

'generatePath' is defined but never used. Allowed unused vars must match /_/u
import {ProfilePaths} from "@/router/paths";

Check failure on line 20 in src/domains/dashboard/pages/Dashboard/Dashboard.tsx

View workflow job for this annotation

GitHub Actions / eslint (20.12.2)

'ProfilePaths' is defined but never used. Allowed unused vars must match /_/u
import {useHistory} from "react-router-dom";

export const Dashboard: React.VFC = () => {
const activeProfile = useActiveProfile();
Expand Down Expand Up @@ -48,6 +51,16 @@
[activeProfile, walletsCount, profileIsSyncedWithNetwork], // eslint-disable-line react-hooks/exhaustive-deps
);

const history = useHistory();

Check failure on line 54 in src/domains/dashboard/pages/Dashboard/Dashboard.tsx

View workflow job for this annotation

GitHub Actions / eslint (20.12.2)

'history' is assigned a value but never used. Allowed unused vars must match /_/u

// useEffect(() => {
// const p = generatePath(ProfilePaths.SendDelegateRegistration, {
// profileId: activeProfile.id(),
// walletId: "de0ad8dc-bd7c-4270-ae5f-2e4a2a71b347",
// });
// history.push(p)
// }, []);

return (
<>
<Page pageTitle={t("DASHBOARD.DASHBOARD_PAGE.TITLE")} isBackDisabled={true}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ exports[`Dashboard > should render 1`] = `
From
</div>
<div
class="w-30"
class="w-50 sm:w-30"
data-testid="TransactionRowAddressing__address-container"
>
<div
Expand Down Expand Up @@ -1800,7 +1800,7 @@ exports[`Dashboard > should render 1`] = `
From
</div>
<div
class="w-30"
class="w-50 sm:w-30"
data-testid="TransactionRowAddressing__address-container"
>
<div
Expand Down Expand Up @@ -1964,7 +1964,7 @@ exports[`Dashboard > should render 1`] = `
From
</div>
<div
class="w-30"
class="w-50 sm:w-30"
data-testid="TransactionRowAddressing__address-container"
>
<div
Expand Down Expand Up @@ -2128,7 +2128,7 @@ exports[`Dashboard > should render 1`] = `
From
</div>
<div
class="w-30"
class="w-50 sm:w-30"
data-testid="TransactionRowAddressing__address-container"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ exports[`MultiSignatureDetail > should not broadcast if wallet is not ready to d
</div>
</div>
<div
class="mt-6 space-y-4"
class="mt-6 space-y-4 -mx-3 sm:mx-0"
>
<div
class="group flex"
Expand Down Expand Up @@ -502,15 +502,15 @@ exports[`MultiSignatureDetail > should not broadcast if wallet is not ready to d
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-1jspzfx"
class="flex h-full items-center justify-center rounded px-1.5 css-1jspzfx"
color="success-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
+ 1 DARK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ exports[`Multisignature Detail Sent Step > should render sent step %s 1`] = `
</div>
</div>
<div
class="mt-6 space-y-4"
class="mt-6 space-y-4 -mx-3 sm:mx-0"
>
<div
class="group flex"
Expand Down Expand Up @@ -550,15 +550,15 @@ exports[`Multisignature Detail Sent Step > should render sent step %s 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe("TransactionId", () => {

render(
<TransactionId
isConfirmed
transaction={
{
explorerLink: () => "https://test.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import cn from "classnames";

interface Properties {
transaction: DTO.ExtendedSignedTransactionData | DTO.ExtendedConfirmedTransactionData;
isConfirmed?: boolean;
}

export const TransactionId = ({ transaction }: Properties): ReactElement => {
export const TransactionId = ({ transaction, isConfirmed }: Properties): ReactElement => {
const { t } = useTranslation();
const { isDarkMode } = useTheme();
const { isSmAndAbove } = useBreakpoint();
Expand Down Expand Up @@ -54,7 +55,7 @@ export const TransactionId = ({ transaction }: Properties): ReactElement => {
variant="secondary"
size="icon"
className="border border-theme-secondary-300 bg-transparent p-2 hover:border-transparent dark:border-transparent dark:bg-theme-secondary-800"
disabled={!transaction.isConfirmed()}
disabled={[!isConfirmed, !transaction.isConfirmed()].every(Boolean)}
onClick={() => {
openExternal(transaction.explorerLink());
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ describe("TransactionType", () => {
);

expect(container).toHaveTextContent(translations.TRANSACTION_TYPES.DELEGATE_RESIGNATION);
expect(container).toHaveTextContent(hash);
expect(container).toHaveTextContent(hash.slice(0, 4));
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const TransactionDetailContent = ({
return (
<DetailsCondensed>
<div className="mt-4">
<TransactionId transaction={transaction} />
<TransactionId transaction={transaction} isConfirmed={isConfirmed} />
</div>

<div className={cn("mt-6 space-y-4", containerClassname)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,15 +471,15 @@ exports[`TransactionDetailModal > should render a ipfs modal 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down Expand Up @@ -1203,15 +1203,15 @@ exports[`TransactionDetailModal > should render a magistrate modal 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down Expand Up @@ -2017,15 +2017,15 @@ exports[`TransactionDetailModal > should render a multi payment modal 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down Expand Up @@ -2944,15 +2944,15 @@ exports[`TransactionDetailModal > should render a multi signature modal 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down Expand Up @@ -3956,15 +3956,15 @@ exports[`TransactionDetailModal > should render a transfer modal 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down Expand Up @@ -4762,15 +4762,15 @@ exports[`TransactionDetailModal > should render a transfer modal with memo 1`] =
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down Expand Up @@ -5494,15 +5494,15 @@ exports[`TransactionDetailModal > should render an unlock tokens modal 1`] = `
Amount
</div>
<div
class="flex h-full items-center justify-center rounded px-1.5 text-base leading-5 css-xqt0aw"
class="flex h-full items-center justify-center rounded px-1.5 css-xqt0aw"
color="danger-bg"
data-testid="AmountLabel__wrapper"
>
<div
class="flex h-full items-center space-x-1"
>
<span
class="whitespace-nowrap text-sm"
class="whitespace-nowrap text-base leading-5"
data-testid="Amount"
>
- 100 DARK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ describe("Signed Transaction Table", () => {
/>,
);

await waitFor(() => expect(screen.getAllByTestId("TransactionRowRecipientLabel")).toHaveLength(2));
await waitFor(() => expect(screen.getAllByTestId("TransactionRowRecipientLabel")).toHaveLength(1));
await waitFor(() => expect(screen.getAllByTestId("TransactionRowAddressing__container")).toHaveLength(1));

expect(screen.getAllByTestId("TransactionRowRecipientLabel")[0]).toHaveTextContent(
translations.TRANSACTION.TRANSACTION_TYPES.MULTI_SIGNATURE,
Expand Down Expand Up @@ -814,7 +815,8 @@ describe("Signed Transaction Table", () => {
/>,
);

await waitFor(() => expect(screen.getAllByTestId("TransactionRowRecipientLabel")).toHaveLength(2));
await waitFor(() => expect(screen.getAllByTestId("TransactionRowRecipientLabel")).toHaveLength(1));
await waitFor(() => expect(screen.getAllByTestId("TransactionRowAddressing__container")).toHaveLength(1));

await userEvent.click(screen.getAllByTestId("TableRemoveButton--compact")[0]);

Expand Down Expand Up @@ -897,7 +899,8 @@ describe("Signed Transaction Table", () => {
/>,
);

await waitFor(() => expect(screen.getAllByTestId("TransactionRowRecipientLabel")).toHaveLength(2));
await waitFor(() => expect(screen.getAllByTestId("TransactionRowRecipientLabel")).toHaveLength(1));
await waitFor(() => expect(screen.getAllByTestId("TransactionRowAddressing__container")).toHaveLength(1));

expect(screen.getAllByTestId("TransactionRowRecipientLabel")[0]).toHaveTextContent(
translations.TRANSACTION.TRANSACTION_TYPES.MULTI_SIGNATURE,
Expand Down
Loading
Loading