-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pci-kuberbetes): display cluster status (#13802)
ref: TAPC-1516 Signed-off-by: Pierre-Philippe <[email protected]> Co-authored-by: CDS Translator Agent <[email protected]>
- Loading branch information
1 parent
63f52c4
commit 2949940
Showing
6 changed files
with
65 additions
and
35 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
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
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
45 changes: 20 additions & 25 deletions
45
packages/manager/apps/pci-kubernetes/src/pages/list/useDatagridColumn.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 |
---|---|---|
@@ -1,36 +1,31 @@ | ||
import { renderHook } from '@testing-library/react'; | ||
import { useDatagridColumn } from './useDatagridColumn'; | ||
|
||
const test = [ | ||
['name', 'kube_list_name'], | ||
['id', 'kube_list_id'], | ||
['region', 'kube_list_region'], | ||
['attachedTo', 'kube_list_network_attached'], | ||
['version', 'kube_list_version'], | ||
['status', 'kube:kube_service_cluster_status'], | ||
['actions', ''], | ||
]; | ||
const columnCount = test.length; | ||
|
||
describe('useDatagridColumn', () => { | ||
it('should return the correct columns', () => { | ||
it.each(test)('should return the correct column for %s', (id, label) => { | ||
const { result } = renderHook(() => useDatagridColumn()); | ||
|
||
const columns = result.current; | ||
|
||
expect(columns).toHaveLength(6); | ||
|
||
const nameColumn = columns.find((col) => col.id === 'name'); | ||
expect(nameColumn).toBeDefined(); | ||
expect(nameColumn?.label).toBe('kube_list_name'); | ||
|
||
const idColumn = columns.find((col) => col.id === 'id'); | ||
expect(idColumn).toBeDefined(); | ||
expect(idColumn?.label).toBe('kube_list_id'); | ||
|
||
const regionColumn = columns.find((col) => col.id === 'region'); | ||
expect(regionColumn).toBeDefined(); | ||
expect(regionColumn?.label).toBe('kube_list_region'); | ||
|
||
const attachedToColumn = columns.find((col) => col.id === 'attachedTo'); | ||
expect(attachedToColumn).toBeDefined(); | ||
expect(attachedToColumn?.label).toBe('kube_list_network_attached'); | ||
const column = columns.find((col) => col.id === id); | ||
expect(column).toBeDefined(); | ||
expect(column.label).toBe(label); | ||
}); | ||
|
||
const versionColumn = columns.find((col) => col.id === 'version'); | ||
expect(versionColumn).toBeDefined(); | ||
expect(versionColumn?.label).toBe('kube_list_version'); | ||
it(`should return ${columnCount} columns`, () => { | ||
const { result } = renderHook(() => useDatagridColumn()); | ||
const columns = result.current; | ||
|
||
const actionsColumn = columns.find((col) => col.id === 'actions'); | ||
expect(actionsColumn).toBeDefined(); | ||
expect(actionsColumn?.label).toBe(''); | ||
expect(columns).toHaveLength(columnCount); | ||
}); | ||
}); |
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