-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathNavigation.test.js
42 lines (38 loc) · 1.7 KB
/
Navigation.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react';
import { render, screen, fireEvent } from '../src/test-utils.js';
import '@testing-library/jest-dom/extend-expect';
import Navigation from '../src/components/Navigation';
describe('Navigation', () => {
test('renders Navigation component with DnD icon button with on click functionality', () => {
const { getByTestId } = render(<Navigation />);
const dndButton = getByTestId('dnd-button');
expect(dndButton).toBeInTheDocument();
const mockFunction = jest.fn(() => true);
fireEvent.click(dndButton);
expect(mockFunction()).toBe(true);
});
test('renders Navigation component with file tree icon button with on click functionality', () => {
const { getByTestId } = render(<Navigation />);
const fileTreeButton = getByTestId('filetree-button');
expect(fileTreeButton).toBeInTheDocument();
const mockFunction = jest.fn(() => true);
fireEvent.click(fileTreeButton);
expect(mockFunction()).toBe(true);
});
test('renders Navigation component with export icon button with on click functionality', () => {
const { getByTestId } = render(<Navigation />);
const exportButton = getByTestId('export-button');
expect(exportButton).toBeInTheDocument();
const mockFunction = jest.fn(() => true);
fireEvent.click(exportButton);
expect(mockFunction()).toBe(true);
});
test('renders Navigation component with trash icon button with on click functionality', () => {
const { getByTestId } = render(<Navigation />);
const trashButton = getByTestId('trash-button');
expect(trashButton).toBeInTheDocument();
const mockFunction = jest.fn(() => true);
fireEvent.click(trashButton);
expect(mockFunction()).toBe(true);
});
});