Skip to content

Commit

Permalink
Merge pull request #242 from systemli/increase-test-coverage
Browse files Browse the repository at this point in the history
✅ Add Test for ErrorView
  • Loading branch information
0x46616c6b authored Mar 1, 2022
2 parents 983ced5 + 22a371d commit 3e6c2c2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
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

0 comments on commit 3e6c2c2

Please sign in to comment.