Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Add Test for ErrorView #242

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ticker-frontend [![Integration](https://github.com/systemli/ticker-frontend/actions/workflows/integration.yaml/badge.svg)](https://github.com/systemli/ticker-frontend/actions/workflows/integration.yaml)
# ticker-frontend

[![Integration](https://github.com/systemli/ticker-frontend/actions/workflows/integration.yaml/badge.svg)](https://github.com/systemli/ticker-frontend/actions/workflows/integration.yaml) [![codecov](https://codecov.io/gh/systemli/ticker-frontend/branch/main/graph/badge.svg?token=bjZUlRawuh)](https://codecov.io/gh/systemli/ticker-frontend)

## Development

Expand Down
25 changes: 21 additions & 4 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ describe('App', function () {
domain: 'example.com',
information: {
author: 'Systemli Ticker Team',
url: '',
email: '',
twitter: '',
facebook: '',
url: 'https://demoticker.org',
email: '[email protected]',
twitter: 'systemli',
facebook: 'betternot',
},
} as Ticker

Expand All @@ -44,6 +44,23 @@ describe('App', function () {
).toBeInTheDocument()
})

test('renders ErrorView', async function () {
jest.spyOn(api, 'getInit').mockRejectedValue(
new Error(
'The server responses with an error: Internal Server Error (500)'
)
)
render(<App />)

expect(screen.getByText('Loading')).toBeInTheDocument()

expect(
await screen.findByText(
'There seems to be a problem connecting to the server.'
)
).toBeInTheDocument()
})

test('renders InactiveView', async function () {
jest.spyOn(api, 'getInit').mockResolvedValue({
data: {
Expand Down