File size: 737 Bytes
f5071ca |
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 |
import { createMemoryHistory } from 'history';
import React from 'react';
import { cleanup, render, fireEvent, waitFor } from '@testing-library/react';
import ChatCreationNavbar from './ChatCreationNavbar';
describe('ChatCreationNavbar', () => {
afterEach(cleanup);
it('goes back on arrow click', async () => {
const history = createMemoryHistory();
history.push('/new-chat');
await waitFor(() => expect(history.location.pathname).toEqual('/new-chat'));
{
const { container, getByTestId } = render(
<ChatCreationNavbar history={history} />
);
fireEvent.click(getByTestId('back-button'));
await waitFor(() => expect(history.location.pathname).toEqual('/chats'));
}
});
});
|