This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d43de0
commit 4101e90
Showing
15 changed files
with
128 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export const HealthBody = ({ children }) => <div className="kubevirt-health__items">{children}</div>; | ||
|
||
HealthBody.propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/components/Dashboard/Health/fixtures/HealthBody.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
|
||
import { HealthBody } from '../HealthBody'; | ||
import { HealthItem } from '../HealthItem'; | ||
import { default as HealthItemFixture } from './HealthItem.fixture'; | ||
|
||
export default { | ||
component: HealthBody, | ||
props: { | ||
children: <HealthItem {...HealthItemFixture[0].props} />, | ||
}, | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/components/Dashboard/Health/fixtures/HealthItem.fixture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { HealthItem } from '../HealthItem'; | ||
|
||
export default [ | ||
{ | ||
component: HealthItem, | ||
props: { | ||
data: { | ||
healthy: { | ||
message: 'OCS is Healthy', | ||
iconname: 'check-circle', | ||
classname: 'ok', | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const HEALTHY= 'OCS is Healthy'; | ||
export const DEGRADED= 'OCS health is Degraded'; | ||
export const ERROR= 'OCS health is in Error State'; | ||
export const UNKNOWN= 'Cannot get OCS health'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { HealthBody } from '../HealthBody'; | ||
import { default as HealthItemFixture } from '../fixtures/HealthItem.fixture'; | ||
import { HealthItem } from '../HealthItem'; | ||
|
||
const testHealthBody = () => ( | ||
<HealthBody> | ||
<HealthItem {...HealthItemFixture[0].props} /> | ||
</HealthBody> | ||
); | ||
|
||
describe('<HealthBody />', () => { | ||
it('renders correctly', () => { | ||
const component = shallow(testHealthBody()); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { HealthItem } from '../HealthItem'; | ||
import { default as HealthItemFixtures } from '../fixtures/HealthItem.fixture'; | ||
|
||
// eslint-disable-next-line react/prop-types | ||
const testHealthItem = ({ props }) => <HealthItem {...props} />; | ||
|
||
describe('<HealthItem />', () => { | ||
it('renders correctly', () => { | ||
HealthItemFixtures.forEach(fixture => { | ||
const component = shallow(testHealthItem(fixture)); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
src/components/Dashboard/Health/tests/__snapshots__/HealthBody.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<HealthBody /> renders correctly 1`] = ` | ||
<div | ||
className="kubevirt-health__items" | ||
> | ||
<HealthItem | ||
data={ | ||
Object { | ||
"healthy": Object { | ||
"classname": "ok", | ||
"iconname": "check-circle", | ||
"message": "OCS is Healthy", | ||
}, | ||
} | ||
} | ||
/> | ||
</div> | ||
`; |
3 changes: 3 additions & 0 deletions
3
src/components/Dashboard/Health/tests/__snapshots__/HealthItem.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<HealthItem /> renders correctly 1`] = `""`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/components/StorageOverview/OCSHealth/fixtures/HealthBody.fixture.js
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/components/StorageOverview/OCSHealth/tests/HealthBody.test.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
src/components/StorageOverview/OCSHealth/tests/__snapshots__/HealthBody.test.js.snap
This file was deleted.
Oops, something went wrong.