From fc50ebf5870fd2ce20d15274c8e0cc54fa56cb64 Mon Sep 17 00:00:00 2001 From: mehditorabiv Date: Fri, 30 Aug 2024 14:58:00 +0300 Subject: [PATCH] update test case --- src/components/layouts/AppbarApp.spec.tsx | 27 +++++++---------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/components/layouts/AppbarApp.spec.tsx b/src/components/layouts/AppbarApp.spec.tsx index 369c6e0..ced36b0 100644 --- a/src/components/layouts/AppbarApp.spec.tsx +++ b/src/components/layouts/AppbarApp.spec.tsx @@ -1,16 +1,11 @@ -import { render, screen, fireEvent } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import { describe, it, expect, vi } from 'vitest'; -import { IconButton, Avatar } from '@mui/material'; import AppbarApp from './AppbarApp'; -vi.mock('./AccountPopover', () => ({ - default: () => ( -
- - - -
AccountPopover
-
+// Mocking the ConnectButton from RainbowKit +vi.mock('@rainbow-me/rainbowkit', () => ({ + ConnectButton: () => ( +
Mocked ConnectButton
), })); @@ -20,18 +15,12 @@ describe('AppbarApp', () => { const appBar = screen.getByTestId('Appbar'); expect(appBar).toBeInTheDocument(); - - const accountPopover = screen.getByTestId('account-popover'); - expect(accountPopover).toBeInTheDocument(); }); - it('should open AccountPopover on icon button click', () => { + it('should render the ConnectButton', () => { render(); - const iconButton = screen.getByTestId('account-popover-button'); - fireEvent.click(iconButton); - - const accountPopover = screen.getByTestId('account-popover'); - expect(accountPopover).toBeVisible(); + const connectButton = screen.getByTestId('connect-button'); + expect(connectButton).toBeInTheDocument(); }); });