mars-v2-frontend/__tests__/components/Account/AccountDetails.test.tsx
Bob van der Helm 3413203ca7
Mp 2949 implemet health computer for borrow (#311)
* implemented max borrow for borrow page

setup basic useHealthComputer

* finish up healthcomputer

* updated tests
2023-07-24 09:44:45 +02:00

27 lines
866 B
TypeScript

import { render, screen } from '@testing-library/react'
import useCurrentAccount from 'hooks/useCurrentAccount'
import AccountDetails from 'components/Account/AccountDetails'
jest.mock('hooks/useCurrentAccount', () => jest.fn(() => null))
const mockedUseCurrentAccount = useCurrentAccount as jest.Mock
describe('<AccountDetails />', () => {
it('renders account details WHEN account is selected', () => {
mockedUseCurrentAccount.mockReturnValue({ id: 1 })
render(<AccountDetails />)
const container = screen.queryByTestId('account-details')
expect(container).toBeInTheDocument()
})
it('does not render WHEN account is NOT selected', () => {
mockedUseCurrentAccount.mockReturnValue(null)
render(<AccountDetails />)
const container = screen.queryByTestId('account-details')
expect(container).not.toBeInTheDocument()
})
})