adjusted test to be more exhaustive of all container and parent node types
This commit is contained in:
@@ -236,18 +236,16 @@ describe('NodeModal', () => {
|
|||||||
|
|
||||||
// ── Container mode ─────────────────────────────────────────────────────
|
// ── Container mode ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
it('shows Container Mode toggle for proxmox type', () => {
|
const containerModeTypes = ['proxmox', 'vm', 'lxc', 'docker_host'] as const
|
||||||
renderModal({ initial: { ...BASE, type: 'proxmox' } })
|
const nonContainerModeTypes = ['isp', 'router', 'switch', 'server', 'nas', 'ap', 'printer', 'iot', 'camera', 'cpl', 'computer', 'generic', 'groupRect', 'group'] as const
|
||||||
|
|
||||||
|
it.each(containerModeTypes)('shows Container Mode toggle for %s type', (type) => {
|
||||||
|
renderModal({ initial: { ...BASE, type } })
|
||||||
expect(screen.getByText('Container Mode')).toBeDefined()
|
expect(screen.getByText('Container Mode')).toBeDefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('hides Container Mode for server type', () => {
|
it.each(nonContainerModeTypes)('hides Container Mode for %s type', (type) => {
|
||||||
renderModal({ initial: { ...BASE, type: 'server' } })
|
renderModal({ initial: { ...BASE, type } })
|
||||||
expect(screen.queryByText('Container Mode')).toBeNull()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('hides Container Mode for groupRect type', () => {
|
|
||||||
renderModal({ initial: { ...BASE, type: 'groupRect' } })
|
|
||||||
expect(screen.queryByText('Container Mode')).toBeNull()
|
expect(screen.queryByText('Container Mode')).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -260,22 +258,25 @@ describe('NodeModal', () => {
|
|||||||
|
|
||||||
// ── Parent container ──────────────────────────────────────────────────
|
// ── Parent container ──────────────────────────────────────────────────
|
||||||
|
|
||||||
it('shows Parent Container when options are provided', () => {
|
const parentContainerVisibleTypes = ['proxmox', 'vm', 'lxc', 'docker_host', 'isp', 'router', 'switch', 'server', 'nas', 'ap', 'printer', 'iot', 'camera', 'cpl', 'computer', 'generic'] as const
|
||||||
|
const parentContainerHiddenTypes = ['groupRect', 'group'] as const
|
||||||
|
|
||||||
|
it.each(parentContainerVisibleTypes)('shows Parent Container for %s type when options are provided', (type) => {
|
||||||
renderModal({
|
renderModal({
|
||||||
initial: { ...BASE, type: 'server' },
|
initial: { ...BASE, type },
|
||||||
parentContainerNodes: [{ id: 'c1', label: 'Container 01' }],
|
parentContainerNodes: [{ id: 'c1', label: 'Container 01' }],
|
||||||
})
|
})
|
||||||
expect(screen.getByText('Parent Container')).toBeDefined()
|
expect(screen.getByText('Parent Container')).toBeDefined()
|
||||||
expect(screen.getByText('Container 01')).toBeDefined()
|
expect(screen.getByText('Container 01')).toBeDefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('hides Parent Container for groupRect type', () => {
|
it.each(parentContainerHiddenTypes)('hides Parent Container for %s type even when options are provided', (type) => {
|
||||||
renderModal({ initial: { ...BASE, type: 'groupRect' }, parentContainerNodes: [{ id: 'c1', label: 'Container 01' }] })
|
renderModal({ initial: { ...BASE, type }, parentContainerNodes: [{ id: 'c1', label: 'Container 01' }] })
|
||||||
expect(screen.queryByText('Parent Container')).toBeNull()
|
expect(screen.queryByText('Parent Container')).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('hides Parent Container when no container options are available', () => {
|
it.each(parentContainerVisibleTypes)('hides Parent Container for %s type when no container options are available', (type) => {
|
||||||
renderModal({ initial: { ...BASE, type: 'server' } })
|
renderModal({ initial: { ...BASE, type } })
|
||||||
expect(screen.queryByText('Parent Container')).toBeNull()
|
expect(screen.queryByText('Parent Container')).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user