Skip to content

Commit

Permalink
Move tests out of pages directory (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
sambiramairelogic authored Jan 24, 2024
1 parent fea8474 commit e9426f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
16 changes: 15 additions & 1 deletion chatbot-ui/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import Home from '../pages/index';

describe('Home Page', () => {
it('Renders', () => {
render(<Home apiUrl="https://localhost" authPassword="testPassword" />);

expect(screen.getByText('Support bot')).toBeInTheDocument();
expect(screen.getByRole('heading', { name: 'Support bot' })).toBeVisible();
});

it('Shows the chatbot dialog once proper auth is entered', async () => {
render(<Home apiUrl={'some-url'} authPassword={'the-right-password'} />);

await userEvent.type(
screen.getByLabelText('Please enter the password'),
'the-right-password',
);

await userEvent.click(screen.getByRole('button', { name: 'Enter' }));

expect(screen.getByLabelText('What is your question?')).toBeVisible();
});
});
25 changes: 0 additions & 25 deletions chatbot-ui/pages/index.test.tsx

This file was deleted.

0 comments on commit e9426f3

Please sign in to comment.