Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions redisinsight/ui/src/assets/img/rdi/empty_pipeline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions redisinsight/ui/src/assets/img/rdi/light_bulb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 48 additions & 2 deletions redisinsight/ui/src/components/auto-refresh/AutoRefresh.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ describe('AutoRefresh', () => {

it('should call onRefresh', () => {
const onRefresh = jest.fn()
render(<AutoRefresh {...instance(mockedProps)} onRefresh={onRefresh} testid="refresh-key-btn" />)
render(<AutoRefresh {...instance(mockedProps)} onRefresh={onRefresh} />)

fireEvent.click(screen.getByTestId('refresh-key-btn'))
fireEvent.click(screen.getByTestId('refresh-btn'))
expect(onRefresh).toBeCalled()
})

Expand All @@ -50,6 +50,52 @@ describe('AutoRefresh', () => {
expect(screen.getByTestId('refresh-message')).toHaveTextContent(DEFAULT_REFRESH_RATE)
})

it('should locate refresh message label when testid is provided', () => {
render(<AutoRefresh {...instance(mockedProps)} displayText testid="testid" />)

expect(screen.getByTestId('testid-refresh-message-label')).toBeInTheDocument()
})

it('should locate refresh message when testid is provided', () => {
render(<AutoRefresh {...instance(mockedProps)} displayText testid="testid" />)

expect(screen.getByTestId('testid-refresh-message')).toBeInTheDocument()
})

it('should locate refresh button when testid is provided', () => {
render(<AutoRefresh {...instance(mockedProps)} testid="testid" />)

expect(screen.getByTestId('testid-refresh-btn')).toBeInTheDocument()
})

it('should locate auto-refresh config button when testid is provided', () => {
render(<AutoRefresh {...instance(mockedProps)} testid="testid" />)

expect(screen.getByTestId('testid-auto-refresh-config-btn')).toBeInTheDocument()
})

it('should locate auto-refresh switch when testid is provided', () => {
render(<AutoRefresh {...instance(mockedProps)} testid="testid" />)

fireEvent.click(screen.getByTestId('testid-auto-refresh-config-btn'))
expect(screen.getByTestId('testid-auto-refresh-switch')).toBeInTheDocument()
})

it('should locate refresh rate when testid is provided', () => {
render(<AutoRefresh {...instance(mockedProps)} testid="testid" />)

fireEvent.click(screen.getByTestId('testid-auto-refresh-config-btn'))
expect(screen.getByTestId('testid-refresh-rate')).toBeInTheDocument()
})

it('should locate auto-refresh rate input when testid is provided', () => {
render(<AutoRefresh {...instance(mockedProps)} testid="testid" />)

fireEvent.click(screen.getByTestId('testid-auto-refresh-config-btn'))
fireEvent.click(screen.getByTestId('testid-refresh-rate'))
expect(screen.getByTestId('testid-auto-refresh-rate-input')).toBeInTheDocument()
})

describe('AutoRefresh Config', () => {
it('Auto refresh config should render', () => {
const { queryByTestId } = render(<AutoRefresh {...instance(mockedProps)} />)
Expand Down
Loading