From 9402063c51e97caf694a73f34eebd6584a0535e3 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 1 Mar 2022 21:24:08 +0100 Subject: [PATCH 1/2] :white_check_mark: Add Test for ErrorView --- src/App.test.tsx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/App.test.tsx b/src/App.test.tsx index a0f6179..af11f28 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -26,10 +26,10 @@ describe('App', function () { domain: 'example.com', information: { author: 'Systemli Ticker Team', - url: '', - email: '', - twitter: '', - facebook: '', + url: 'https://demoticker.org', + email: 'admin@demoticker.org', + twitter: 'systemli', + facebook: 'betternot', }, } as Ticker @@ -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() + + 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: { From 22a371d0df3dc9bfb1f51fe68564d915144b828f Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 1 Mar 2022 21:25:26 +0100 Subject: [PATCH 2/2] :memo: Add Badge for Code Coverage --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 44a6dee..09d8188 100644 --- a/README.md +++ b/README.md @@ -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