-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathMoneyHeader.test.tsx
More file actions
23 lines (18 loc) · 761 Bytes
/
MoneyHeader.test.tsx
File metadata and controls
23 lines (18 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import React from 'react';
import { render, fireEvent } from '@testing-library/react-native';
import MoneyHeader from './MoneyHeader';
import { MoneyHeaderTestIds } from './MoneyHeader.testIds';
describe('MoneyHeader', () => {
it('renders the menu button', () => {
const { getByTestId } = render(<MoneyHeader onMenuPress={jest.fn()} />);
expect(getByTestId(MoneyHeaderTestIds.MENU_BUTTON)).toBeOnTheScreen();
});
it('calls onMenuPress when the menu button is pressed', () => {
const mockOnMenuPress = jest.fn();
const { getByTestId } = render(
<MoneyHeader onMenuPress={mockOnMenuPress} />,
);
fireEvent.press(getByTestId(MoneyHeaderTestIds.MENU_BUTTON));
expect(mockOnMenuPress).toHaveBeenCalledTimes(1);
});
});