Skip to content

Commit

Permalink
update jest test for statusCheckState prop enum
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed May 15, 2018
1 parent 08081cf commit 101a8d1
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exports[`render 1`] = `
</div>
`;

exports[`status check checking status 1`] = `
exports[`statusCheckState checking status 1`] = `
<div
className="kuiVerticalRhythmLarge"
>
Expand Down Expand Up @@ -207,7 +207,7 @@ exports[`status check checking status 1`] = `
</div>
`;

exports[`status check failed status check 1`] = `
exports[`statusCheckState failed status check - error 1`] = `
<div
className="kuiVerticalRhythmLarge"
>
Expand Down Expand Up @@ -330,7 +330,7 @@ exports[`status check failed status check 1`] = `
/>
</UNDEFINED>,
"key": "checkStatusStep",
"status": "incomplete",
"status": "complete",
"title": "custom title",
},
]
Expand All @@ -339,7 +339,7 @@ exports[`status check failed status check 1`] = `
</div>
`;

exports[`status check initial state - no check has been attempted 1`] = `
exports[`statusCheckState failed status check - no data 1`] = `
<div
className="kuiVerticalRhythmLarge"
>
Expand Down Expand Up @@ -455,6 +455,138 @@ exports[`status check initial state - no check has been attempted 1`] = `
<EuiSpacer
size="s"
/>
<EuiCallOut
color="warning"
size="m"
title="custom error msg"
/>
</UNDEFINED>,
"key": "checkStatusStep",
"status": "complete",
"title": "custom title",
},
]
}
/>
</div>
`;

exports[`statusCheckState initial state - no check has been attempted 1`] = `
<div
className="kuiVerticalRhythmLarge"
>
<KuiBar
className="kuiVerticalRhythm"
>
<KuiBarSection>
<div
className="kuiTitle"
>
title1
</div>
</KuiBarSection>
<KuiBarSection />
</KuiBar>
<EuiTabs
className="kuiVerticalRhythm"
>
<EuiTab
disabled={false}
isSelected={true}
key="0"
onClick={[Function]}
>
OSX
</EuiTab>
<EuiTab
disabled={false}
isSelected={false}
key="1"
onClick={[Function]}
>
Windows
</EuiTab>
</EuiTabs>
<EuiSpacer
size="m"
/>
<EuiSteps
firstStepNumber={1}
headingElement="p"
steps={
Array [
Object {
"children": <Instruction
commands={
Array [
"do stuff in command line",
]
}
paramValues={Object {}}
replaceTemplateStrings={[Function]}
textPost={undefined}
textPre={undefined}
/>,
"key": 0,
"title": "step 1",
},
Object {
"children": <Instruction
commands={
Array [
"do more stuff in command line",
]
}
paramValues={Object {}}
replaceTemplateStrings={[Function]}
textPost={undefined}
textPre={undefined}
/>,
"key": 1,
"title": "step 2",
},
Object {
"children": <UNDEFINED>
<EuiFlexGroup
alignItems="center"
component="div"
direction="row"
gutterSize="l"
justifyContent="spaceBetween"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={true}
>
<EuiText
grow={true}
>
<p>
custom status check description
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={false}
>
<EuiButton
color="primary"
fill={false}
iconSide="left"
isLoading={true}
onClick={[Function]}
type="button"
>
custom btn label
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer
size="s"
/>
</UNDEFINED>,
"key": "checkStatusStep",
"status": "incomplete",
Expand All @@ -466,7 +598,7 @@ exports[`status check initial state - no check has been attempted 1`] = `
</div>
`;

exports[`status check successful status check 1`] = `
exports[`statusCheckState successful status check 1`] = `
<div
className="kuiVerticalRhythmLarge"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { shallow } from 'enzyme';
import {
InstructionSet,
} from './instruction_set';
import * as StatusCheckStates from './status_check_states';

const instructions = [
{
Expand Down Expand Up @@ -43,7 +44,7 @@ test('render', () => {
expect(component).toMatchSnapshot(); // eslint-disable-line
});

describe('status check', () => {
describe('statusCheckState', () => {
const statusCheckConfig = {
success: 'custom success msg',
error: 'custom error msg',
Expand All @@ -61,9 +62,7 @@ describe('status check', () => {
paramValues={{}}
statusCheckConfig={statusCheckConfig}
replaceTemplateStrings={() => {}}
statusCheckState="incomplete"
hasStatusCheckFailed={false}
isCheckingStatus={false}
statusCheckState={StatusCheckStates.FETCHING}
/>);
expect(component).toMatchSnapshot(); // eslint-disable-line
});
Expand All @@ -77,14 +76,12 @@ describe('status check', () => {
paramValues={{}}
statusCheckConfig={statusCheckConfig}
replaceTemplateStrings={() => {}}
statusCheckState="incomplete"
hasStatusCheckFailed={false}
isCheckingStatus={true}
statusCheckState={StatusCheckStates.FETCHING}
/>);
expect(component).toMatchSnapshot(); // eslint-disable-line
});

test('failed status check', () => {
test('failed status check - error', () => {
const component = shallow(<InstructionSet
title="title1"
instructionVariants={instructionVariants}
Expand All @@ -93,9 +90,21 @@ describe('status check', () => {
paramValues={{}}
statusCheckConfig={statusCheckConfig}
replaceTemplateStrings={() => {}}
statusCheckState="incomplete"
hasStatusCheckFailed={true}
isCheckingStatus={false}
statusCheckState={StatusCheckStates.ERROR}
/>);
expect(component).toMatchSnapshot(); // eslint-disable-line
});

test('failed status check - no data', () => {
const component = shallow(<InstructionSet
title="title1"
instructionVariants={instructionVariants}
onStatusCheck={() => {}}
offset={1}
paramValues={{}}
statusCheckConfig={statusCheckConfig}
replaceTemplateStrings={() => {}}
statusCheckState={StatusCheckStates.NO_DATA}
/>);
expect(component).toMatchSnapshot(); // eslint-disable-line
});
Expand All @@ -109,9 +118,7 @@ describe('status check', () => {
paramValues={{}}
statusCheckConfig={statusCheckConfig}
replaceTemplateStrings={() => {}}
statusCheckState="complete"
hasStatusCheckFailed={false}
isCheckingStatus={false}
statusCheckState={StatusCheckStates.HAS_DATA}
/>);
expect(component).toMatchSnapshot(); // eslint-disable-line
});
Expand Down

0 comments on commit 101a8d1

Please sign in to comment.