From e617b8754ff7c0f3765dcd62aa11a1eecb6a4a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kiner-tang=28=E6=96=87=E8=BE=89=29?= <1127031143@qq.com> Date: Thu, 28 Dec 2023 22:14:49 +0800 Subject: [PATCH] test: update test case --- .../src/nft-card/__tests__/action.test.tsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/web3/src/nft-card/__tests__/action.test.tsx b/packages/web3/src/nft-card/__tests__/action.test.tsx index fe4376bd9..418a54895 100644 --- a/packages/web3/src/nft-card/__tests__/action.test.tsx +++ b/packages/web3/src/nft-card/__tests__/action.test.tsx @@ -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( + , + ); + // 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(); + }); });