Skip to content

Commit

Permalink
test: remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
varshamenon4 committed Nov 21, 2024
1 parent 0fac6e8 commit cc1e941
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions src/widgets/Xpert.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,51 +348,3 @@ test('survey monkey survey should appear after closing sidebar', async () => {
expect(survey).toBeCalledTimes(1);
survey.mockRestore();
});
// todo: test that today divider doesn't appear with no messages
test('message divider does not appear when no messages', async () => {
const user = userEvent.setup();

render(<Xpert courseId={courseId} contentToolsEnabled={false} unitId={unitId} />, { preloadedState: initialState });

// wait for button to appear
await screen.findByTestId('toggle-button');

await user.click(screen.queryByTestId('toggle-button'));

// assert that UI elements present in the sidebar are visible
expect(screen.getByRole('heading', { name: 'Hi, I\'m Xpert!' })).toBeVisible();
expect(screen.getByRole('textbox')).toBeVisible();
expect(screen.getByRole('button', { name: 'submit' })).toBeVisible();
expect(screen.getByTestId('close-button')).toBeVisible();

expect(screen.getByText('Today')).toBeVisible();
});
// todo: test that today divider doesn't appear when messages all from today
// todo: test that today divider appears when message from before today
// todo: test that today divider correctly divides messages between today and yesterday
test('addt appears as message in the sidebar', async () => {
const user = userEvent.setup();
const userMessage = 'Hello, Xpert!';

render(<Xpert courseId={courseId} contentToolsEnabled={false} unitId={unitId} />, { preloadedState: initialState });

// wait for button to appear
await screen.findByTestId('toggle-button');

await user.click(screen.queryByTestId('toggle-button'));

// type the user message
const input = screen.getByRole('textbox');
await user.type(input, userMessage);

// because we use a controlled input element, assert that user's message appears in the input element
expect(input).toHaveValue(userMessage);

await user.click(screen.getByRole('button', { name: 'submit' }));

// assert that UI elements in the sidebar are in the DOM
expect(screen.getByText(userMessage)).toBeInTheDocument();

// because we use a controlled input element, assert that the input element is cleared
expect(input).toHaveValue('');
});

0 comments on commit cc1e941

Please sign in to comment.