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
karthik
committed
Dec 16, 2020
1 parent
f9339b9
commit a333500
Showing
2 changed files
with
48 additions
and
1 deletion.
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
44 changes: 44 additions & 0 deletions
44
...s-plugin/src/components/pipelines/list-page/__tests__/PipelineAugmentRunsWrapper.spec.tsx
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,44 @@ | ||
import * as React from 'react'; | ||
import { shallow, ShallowWrapper } from 'enzyme'; | ||
import { Firehose } from '@console/internal/components/utils'; | ||
import { ListPageWrapper_ as ListPageWrapper } from '@console/internal/components/factory'; | ||
import { PipelineExampleNames, pipelineTestData } from '../../../../test-data/pipeline-data'; | ||
import PipelineAugmentRunsWrapper from '../PipelineAugmentRunsWrapper'; | ||
import PipelineAugmentRuns from '../PipelineAugmentRuns'; | ||
|
||
const mockData = pipelineTestData[PipelineExampleNames.WORKSPACE_PIPELINE]; | ||
const { pipeline } = mockData; | ||
|
||
type PipelineAugmentRunsWrapperProps = React.ComponentProps<typeof PipelineAugmentRunsWrapper>; | ||
|
||
describe('Pipeline Augment Run Wrapper', () => { | ||
let pipelineAugmentRunsWrapperProps: PipelineAugmentRunsWrapperProps; | ||
let wrapper: ShallowWrapper; | ||
beforeEach(() => { | ||
pipelineAugmentRunsWrapperProps = { | ||
pipeline: { | ||
data: [pipeline], | ||
loaded: false, | ||
}, | ||
}; | ||
wrapper = shallow(<PipelineAugmentRunsWrapper {...pipelineAugmentRunsWrapperProps} />); | ||
}); | ||
|
||
it('Should not render if the firehose call is not yet loaded', () => { | ||
expect(wrapper.html()).toBeNull(); | ||
}); | ||
|
||
it('Should render No Pipelines found text if the data is empty', () => { | ||
wrapper.setProps({ pipeline: { data: [], loaded: true } }); | ||
expect(wrapper.find('div.text-center').text()).toBe('No Pipelines Found'); | ||
}); | ||
|
||
it('Should render firehose if the pipeline data is loaded and available', () => { | ||
wrapper.setProps({ pipeline: { data: [pipeline], loaded: true } }); | ||
const firehoseComponent = wrapper.find(Firehose); | ||
|
||
expect(firehoseComponent.exists()).toBeTruthy(); | ||
expect(firehoseComponent.find(PipelineAugmentRuns).exists()).toBeTruthy(); | ||
expect(firehoseComponent.find(ListPageWrapper).exists()).toBeTruthy(); | ||
}); | ||
}); |