mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Created ServerError test
This commit is contained in:
parent
b011b4e1d8
commit
c8cf75fa28
1 changed files with 35 additions and 0 deletions
35
test/servers/helpers/ServerError.test.js
Normal file
35
test/servers/helpers/ServerError.test.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { ServerError } from '../../../src/servers/helpers/ServerError';
|
||||
|
||||
describe('<ServerError />', () => {
|
||||
let wrapper;
|
||||
|
||||
afterEach(() => wrapper && wrapper.unmount());
|
||||
|
||||
it.each([
|
||||
[
|
||||
'not-found',
|
||||
[ 'Could not find this Shlink server.' ],
|
||||
'These are the Shlink servers',
|
||||
],
|
||||
[
|
||||
'not-reachable',
|
||||
[
|
||||
'Oops! Could not connect to this Shlink server.',
|
||||
'Make sure you have internet connection, and the server is properly configured and on-line.',
|
||||
],
|
||||
'These are the other Shlink servers',
|
||||
],
|
||||
])('renders expected information based on type', (type, expectedTitleParts, expectedBody) => {
|
||||
wrapper = shallow(<BrowserRouter><ServerError type={type} servers={{ list: [] }} /></BrowserRouter>);
|
||||
const wrapperText = wrapper.html();
|
||||
const textsToFind = [ ...expectedTitleParts, ...expectedBody ];
|
||||
|
||||
expect.assertions(textsToFind.length);
|
||||
textsToFind.forEach((text) => {
|
||||
expect(wrapperText).toContain(text);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue