Skip to content

Commit

Permalink
test: ensuring alert component is displayed if QueryState send one
Browse files Browse the repository at this point in the history
  • Loading branch information
axel7083 committed Jan 30, 2024
1 parent b2de7bc commit a8098a6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/frontend/src/pages/ModelPlayground.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,33 @@ test('should display query without response', async () => {
expect(response).toBeInTheDocument();
expect(response).toHaveValue('The response is 2');
});

test('should display error alert', async () => {
mocks.playgroundQueriesSubscribeMock.mockReturnValue([
{
id: 1,
modelId: 'model1',
prompt: 'what is 1+1?',
error: 'dummy error'

Check warning on line 150 in packages/frontend/src/pages/ModelPlayground.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

Missing trailing comma

Check warning on line 150 in packages/frontend/src/pages/ModelPlayground.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-22.04

Missing trailing comma

Check warning on line 150 in packages/frontend/src/pages/ModelPlayground.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / macos-12

Missing trailing comma
},
]);
render(ModelPlayground, {
model: {
id: 'model1',
name: 'Model 1',
description: 'A description',
hw: 'CPU',
registry: 'Hugging Face',
popularity: 3,
license: '?',
url: 'https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q5_K_S.gguf',
} as ModelInfo,
});

await waitFor(() => {
const alert = screen.getByRole('alert');
expect(alert).toBeDefined();
});

});

0 comments on commit a8098a6

Please sign in to comment.