Skip to content

Commit ddb6ebd

Browse files
committed
#RI-3903 - fix tests
1 parent 2e9856f commit ddb6ebd

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

redisinsight/ui/src/components/import-databases-dialog/ImportDatabasesDialog.spec.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,25 @@ describe('ImportDatabasesDialog', () => {
9292
expect(screen.getByTestId('file-loading-indicator')).toBeInTheDocument()
9393
})
9494

95-
it('should render success message when at least 1 database added', () => {
95+
it('should not render error message without error', () => {
9696
(importInstancesSelector as jest.Mock).mockImplementation(() => ({
9797
loading: false,
98-
data: {
99-
success: 1,
100-
total: 2
101-
}
98+
data: {}
10299
}))
103100

104101
render(<ImportDatabasesDialog onClose={jest.fn()} />)
105-
expect(screen.getByTestId('result-success')).toBeInTheDocument()
106102
expect(screen.queryByTestId('result-failed')).not.toBeInTheDocument()
107103
})
108104

109105
it('should render error message when 0 success databases added', () => {
110106
(importInstancesSelector as jest.Mock).mockImplementation(() => ({
111107
loading: false,
112-
data: {
113-
success: 0,
114-
total: 2
115-
}
108+
data: null,
109+
error: 'Error message'
116110
}))
117111

118112
render(<ImportDatabasesDialog onClose={jest.fn()} />)
119113
expect(screen.getByTestId('result-failed')).toBeInTheDocument()
120-
expect(screen.queryByTestId('result-success')).not.toBeInTheDocument()
114+
expect(screen.getByTestId('result-failed')).toHaveTextContent('Error message')
121115
})
122116
})

0 commit comments

Comments
 (0)