Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKurt committed Jun 3, 2024
1 parent 39bdee0 commit cdb916b
Show file tree
Hide file tree
Showing 4 changed files with 12,579 additions and 17,862 deletions.
16 changes: 12 additions & 4 deletions packages/round-manager/src/features/round/QuadraticFundingForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import {
SelectorIcon,
} from "@heroicons/react/solid";
import { yupResolver } from "@hookform/resolvers/yup";
import { TToken, classNames, getPayoutTokens, stringToBlobUrl } from "common";
import {
NATIVE,
TToken,
classNames,
getPayoutTokens,
stringToBlobUrl,
} from "common";
import { Input } from "common/src/styles";
import _ from "lodash";
import { Fragment, useContext, useState } from "react";
Expand Down Expand Up @@ -103,7 +109,9 @@ export default function QuadraticFundingForm(props: QuadraticFundingFormProps) {
canVote: false,
redstoneTokenId: "",
},
...getPayoutTokens(chain.id),
...getPayoutTokens(chain.id).filter(
(token) => token.address.toLowerCase() !== NATIVE.toLowerCase()
),
];

const {
Expand Down Expand Up @@ -282,7 +290,7 @@ function PayoutTokenButton(props: {
<span className="flex items-center">
{token?.icon ? (
<img
src={token?.icon}
src={stringToBlobUrl(token.icon)}
alt=""
className="h-6 w-6 flex-shrink-0 rounded-full"
/>
Expand Down Expand Up @@ -373,7 +381,7 @@ function PayoutTokenDropdown(props: {
(token) =>
!token.default && (
<Listbox.Option
key={token.code}
key={token.address}
className={({ active }) =>
classNames(
active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,16 @@ describe("fund contract tab", () => {
}));

(getPayoutTokens as jest.Mock).mockImplementation((chainId) => {
return {
data: [
{
name: "ETH",
chainId: 1,
address: "0x0000000000000000000000000000000000000000",
redstoneTokenId: "ETH",
decimal: 18,
},
],
};
return [
{
code: "ETH",
address: "0x0000000000000000000000000000000000000000",
redstoneTokenId: "ETH",
decimals: 18,
icon: "",
canVote: true,
},
];
});

render(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { fireEvent, screen } from "@testing-library/react";
import { renderWrapped } from "../../../test-utils";
import { getPayoutTokens } from "common";
import { NATIVE, getPayoutTokens } from "common";

import { useWallet } from "../../common/Auth";
import { FormStepper } from "../../common/FormStepper";
Expand Down Expand Up @@ -43,7 +43,9 @@ describe("<QuadraticFundingForm />", () => {
});

it("renders a dropdown list of tokens when payout token input is clicked", async () => {
const options = getPayoutTokens(10);
const options = getPayoutTokens(10).filter(
(token) => token.address.toLowerCase() !== NATIVE.toLowerCase()
);

const payoutTokenSelection = screen.getByTestId("payout-token-select");
fireEvent.click(payoutTokenSelection);
Expand Down
Loading

0 comments on commit cdb916b

Please sign in to comment.