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

fix: asset list cleanup #201

Merged
merged 2 commits into from
Jan 10, 2025
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
30 changes: 12 additions & 18 deletions components/bank/components/__tests__/tokenList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ describe('TokenList', () => {
pageSize={1}
/>
);
expect(screen.getByText('utoken1')).toBeInTheDocument();
const token1Row = screen.getByLabelText('utoken1');
expect(token1Row).toBeInTheDocument();

const ticker = within(token1Row).getAllByText('TOKEN 1');
expect(ticker).toHaveLength(2);

const balance = within(token1Row).getByText('0.001');
expect(balance).toBeInTheDocument();
});

test('displays loading skeleton when isLoading is true', () => {
Expand Down Expand Up @@ -114,8 +121,10 @@ describe('TokenList', () => {
searchTerm={'Token 1'}
/>
);
expect(screen.getByText('Token 1')).toBeInTheDocument();
expect(screen.queryByText('Token 2')).not.toBeInTheDocument();
const token1Row = screen.getByLabelText('utoken1');
const token2Row = screen.queryByLabelText('utoken2');
expect(token1Row).toBeInTheDocument();
expect(token2Row).not.toBeInTheDocument();
});

test('opens modal with correct denomination information', async () => {
Expand Down Expand Up @@ -155,19 +164,4 @@ describe('TokenList', () => {
expect(screen.getByText('0.001')).toBeInTheDocument();
expect(screen.getByText('0.002')).toBeInTheDocument();
});

test('displays correct base denomination for each token', () => {
renderWithChainProvider(
<TokenList
balances={mockBalances}
isLoading={false}
refetchBalances={jest.fn()}
refetchHistory={jest.fn()}
address={''}
pageSize={2}
/>
);
expect(screen.getByText('utoken1')).toBeInTheDocument();
expect(screen.getByText('utoken2')).toBeInTheDocument();
});
});
11 changes: 3 additions & 8 deletions components/bank/components/tokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,9 @@ export function TokenList(props: Readonly<TokenListProps>) {
<div className=" flex items-center justify-center">
<DenomImage denom={balance.metadata} />
</div>
<div>
<p className="font-semibold text-[#161616] dark:text-white">
{truncateString(balance.metadata?.display ?? '', 12)}
</p>
<p className="text-sm text-[#00000099] dark:text-[#FFFFFF99]">
{balance.metadata?.denom_units[0]?.denom.split('/').pop()}
</p>
</div>
<p className="font-semibold text-[#161616] dark:text-white">
{truncateString(balance.metadata?.display ?? '', 12).toUpperCase()}
</p>
</div>
<div className="text-center hidden sm:block md:block lg:hidden xl:block">
<p className="font-semibold text-[#161616] dark:text-white">
Expand Down
Loading