2018-07-22 19:10:28 +00:00
|
|
|
import React from 'react'
|
|
|
|
import { shallow } from 'enzyme'
|
|
|
|
|
|
|
|
import DegradedNotice from '../DegradedNotice'
|
|
|
|
|
|
|
|
it('renders without crashing', () => {
|
2018-08-08 23:43:53 +00:00
|
|
|
shallow(<DegradedNotice services={{ first: null, second: null }} />)
|
2018-07-22 19:10:28 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('shows one service', () => {
|
2018-08-08 23:43:53 +00:00
|
|
|
const comp = shallow(<DegradedNotice services={{ first: null }} />)
|
2018-07-22 19:10:28 +00:00
|
|
|
expect(comp.contains(<header>1 service is unreachable</header>)).toEqual(true)
|
2018-08-08 23:43:53 +00:00
|
|
|
expect(
|
|
|
|
comp.contains(
|
|
|
|
<p>
|
|
|
|
elstat is having trouble contacting <strong>first</strong>.
|
|
|
|
</p>
|
|
|
|
)
|
|
|
|
).toEqual(true)
|
2018-07-22 19:10:28 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it('shows multiple services', () => {
|
2018-08-08 23:43:53 +00:00
|
|
|
const comp = shallow(
|
|
|
|
<DegradedNotice services={{ first: null, second: null, third: null }} />
|
|
|
|
)
|
|
|
|
expect(comp.contains(<header>3 services are unreachable</header>)).toEqual(
|
|
|
|
true
|
|
|
|
)
|
|
|
|
expect(
|
|
|
|
comp.contains(
|
|
|
|
<p>
|
|
|
|
elstat is having trouble contacting{' '}
|
|
|
|
<strong>first, second, third</strong>.
|
|
|
|
</p>
|
|
|
|
)
|
|
|
|
).toEqual(true)
|
2018-07-22 19:10:28 +00:00
|
|
|
})
|