Skip to content

Commit

Permalink
test: update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
kiner-tang committed Dec 28, 2023
1 parent fed1ac3 commit e617b87
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/web3/src/nft-card/__tests__/action.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,25 @@ describe('NFTCard actions', () => {
fireEvent.click(baseElement.querySelector('.ant-nft-card-action .ant-btn')!);
expect(actionFn).toHaveBeenCalled();
});
it('render action with default actionText', () => {
const actionFn = vi.fn();
const address = '0x21CDf0974d53a6e96eF05d7B324a9803735fFd3B';
const tokenId = 123;

const { baseElement } = render(
<NFTCard
address={address}
tokenId={tokenId}
showAction
onActionClick={actionFn}
price={{
value: 139999n,
}}
/>,
);
// Ensure the like and price elements are rendered
expect(baseElement.querySelector('.ant-nft-card-action')?.textContent).toBe('Buy Now');
fireEvent.click(baseElement.querySelector('.ant-nft-card-action .ant-btn')!);
expect(actionFn).toHaveBeenCalled();
});
});

0 comments on commit e617b87

Please sign in to comment.