Skip to content

Commit

Permalink
#116 - hide Queue Modal table header/footer (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
obr42 authored Sep 30, 2022
1 parent 059e790 commit 9d160b9
Showing 4 changed files with 59 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/components/QueueModal.test.tsx
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ describe('Queue Modal', () => {
await waitFor(() => {
expect(screen.getByRole('table')).toBeInTheDocument()
})
expect(screen.getByRole('heading')).toBeInTheDocument()
expect(
screen.getByRole('columnheader', { name: 'Name' }),
).toBeInTheDocument()
2 changes: 2 additions & 0 deletions src/components/QueueModal.tsx
Original file line number Diff line number Diff line change
@@ -119,6 +119,8 @@ const QueueModal = ({ instance }: IQueueModal) => {
data={queueData}
columns={useTableColumns()}
maxrows={10}
hidePagination
hideToolbar
/>
</Stack>
<ModalWrapper
48 changes: 48 additions & 0 deletions src/pages/SystemAdmin/SystemCardInstances.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { fireEvent, render, screen } from '@testing-library/react'
import { TInstance, TInstance2 } from 'test/test-values'
import { AllProviders } from 'test/testMocks'

import SystemCardInstances from './SystemCardInstances'

describe('SystemCard actions', () => {
test('renders a menu button per instance', async () => {
render(
<AllProviders>
<SystemCardInstances
instances={[TInstance, TInstance2]}
fileHeader={'TestNamespace'}
/>
</AllProviders>,
)
expect(screen.getByText('testInstance')).toBeInTheDocument()
expect(screen.getByText('secondInstance')).toBeInTheDocument()
})

test('opens queue modal', async () => {
render(
<AllProviders>
<SystemCardInstances
instances={[TInstance]}
fileHeader={'TestNamespace'}
/>
</AllProviders>,
)
fireEvent.click(screen.getByText('testInstance'))
fireEvent.click(screen.getByText('Manage Queue'))
expect(await screen.findByText(/Queue Manager:/)).toBeInTheDocument()
})

test('opens log modal', async () => {
render(
<AllProviders>
<SystemCardInstances
instances={[TInstance]}
fileHeader={'TestNamespace'}
/>
</AllProviders>,
)
fireEvent.click(screen.getByText('testInstance'))
fireEvent.click(screen.getByText('Show Logs'))
expect(await screen.findByText(/Logs for/)).toBeInTheDocument()
})
})
9 changes: 9 additions & 0 deletions src/test/test-values.ts
Original file line number Diff line number Diff line change
@@ -54,6 +54,15 @@ export const TInstance: Instance = {
queue_type: 'queued',
}

export const TInstance2: Instance = {
description: 'another instance to test',
id: 'secondInst',
name: 'secondInstance',
status: 'INITIALIZING',
status_info: { heartbeat: 70 },
queue_type: 'queued',
}

export const TLog =
'This is a test log\nMultiples line items\nJust to test with'

0 comments on commit 9d160b9

Please sign in to comment.