-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic test to see correct cluster type is used
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
assets/js/components/ClusterDetails/ClusterDetailsPage.test.jsx
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,38 @@ | ||
import React from 'react'; | ||
|
||
import { screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { withState, renderWithRouterMatch } from '@lib/test-utils'; | ||
|
||
import { clusterFactory } from '@lib/test-utils/factories'; | ||
|
||
import { ClusterDetailsPage } from './ClusterDetailsPage'; | ||
|
||
describe('ClusterDetails ClusterDetailsPage component', () => { | ||
it.each([ | ||
{ type: 'hana_scale_up', label: 'HANA scale-up' }, | ||
{ type: 'ascs_ers', label: 'ASCS/ERS' }, | ||
{ type: 'unknwon', label: 'Unknown cluster type' }, | ||
])('should display the $type details based on cluster type', ({ type, label }) => { | ||
const cluster = clusterFactory.build({ type }) | ||
const initialState = { | ||
clustersList: { clusters: [cluster] }, | ||
hostsList: { hosts: []}, | ||
lastExecutions: { | ||
[cluster.id]: { data: null, loading: false, error: null} | ||
} | ||
}; | ||
|
||
const [statefulClusterDetailsPage, _] = withState( | ||
<ClusterDetailsPage />, | ||
initialState | ||
); | ||
|
||
renderWithRouterMatch(statefulClusterDetailsPage, { | ||
path: 'clusters/:clusterID', | ||
route: `/clusters/${cluster.id}`, | ||
}); | ||
|
||
expect(screen.getByText(label)).toBeInTheDocument(); | ||
}); | ||
}); |