Skip to content

Commit 1112d90

Browse files
Merge pull request #461 from RedisInsight/feature/bugfix
#RI-2470, #RI-2630, #RI-2634
2 parents 0b02357 + 535f159 commit 1112d90

File tree

21 files changed

+291
-142
lines changed

21 files changed

+291
-142
lines changed

redisinsight/ui/src/components/config/Config.spec.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
import { getServerInfo } from 'uiSrc/slices/app/info'
1111
import { processCliClient } from 'uiSrc/slices/cli/cli-settings'
1212
import { getRedisCommands } from 'uiSrc/slices/app/redis-commands'
13-
import { getContent as getCreateRedisButtons } from 'uiSrc/slices/content/create-redis-buttons'
1413
import Config from './Config'
1514

1615
let store: typeof mockedStore
@@ -39,7 +38,6 @@ describe('Config', () => {
3938
getServerInfo(),
4039
processCliClient(),
4140
getRedisCommands(),
42-
getCreateRedisButtons(),
4341
getUserConfigSettings()
4442
]
4543
expect(store.getActions()).toEqual([...afterRenderActions])
@@ -69,7 +67,6 @@ describe('Config', () => {
6967
getServerInfo(),
7068
processCliClient(),
7169
getRedisCommands(),
72-
getCreateRedisButtons(),
7370
getUserConfigSettings(),
7471
setSettingsPopupState(true),
7572
]

redisinsight/ui/src/components/config/Config.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { checkIsAnalyticsGranted, getTelemetryService } from 'uiSrc/telemetry'
1919
import { setFavicon, isDifferentConsentsExists } from 'uiSrc/utils'
2020
import { fetchUnsupportedCliCommandsAction } from 'uiSrc/slices/cli/cli-settings'
2121
import { fetchRedisCommandsInfo } from 'uiSrc/slices/app/redis-commands'
22-
import { fetchContentAction as fetchCreateRedisButtonsAction } from 'uiSrc/slices/content/create-redis-buttons'
2322
import favicon from 'uiSrc/assets/favicon.ico'
2423

2524
const SETTINGS_PAGE_PATH = '/settings'
@@ -37,7 +36,6 @@ const Config = () => {
3736
dispatch(fetchServerInfo())
3837
dispatch(fetchUnsupportedCliCommandsAction())
3938
dispatch(fetchRedisCommandsInfo())
40-
dispatch(fetchCreateRedisButtonsAction())
4139

4240
// fetch config settings, after that take spec
4341
if (pathname !== SETTINGS_PAGE_PATH) {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { cloneDeep } from 'lodash'
2+
import React from 'react'
3+
import { instance, mock } from 'ts-mockito'
4+
import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils'
5+
import ShortInstanceInfo, { Props } from './ShortInstanceInfo'
6+
7+
const mockedProps = mock<Props>()
8+
9+
let store: typeof mockedStore
10+
beforeEach(() => {
11+
cleanup()
12+
store = cloneDeep(mockedStore)
13+
store.clearActions()
14+
})
15+
16+
jest.mock('uiSrc/services', () => ({
17+
...jest.requireActual('uiSrc/services'),
18+
sessionStorageService: {
19+
set: jest.fn(),
20+
get: jest.fn(),
21+
},
22+
}))
23+
24+
describe('ShortInstanceInfo', () => {
25+
it('should render', () => {
26+
expect(render(<ShortInstanceInfo info={{ ...instance(mockedProps) }} />)).toBeTruthy()
27+
})
28+
})

redisinsight/ui/src/components/instance-header/components/ShortInstanceInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ReactComponent as VersionIcon } from 'uiSrc/assets/img/icons/version.sv
1111

1212
import styles from './styles.module.scss'
1313

14-
interface IProps {
14+
export interface Props {
1515
info: {
1616
name: string
1717
host: string
@@ -22,7 +22,7 @@ interface IProps {
2222
user?: Nullable<string>
2323
}
2424
}
25-
const ShortInstanceInfo = ({ info }: IProps) => {
25+
const ShortInstanceInfo = ({ info }: Props) => {
2626
const { name, host, port, connectionType, version, user, dbIndex } = info
2727
return ((
2828
<div data-testid="db-info-tooltip">
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { cloneDeep } from 'lodash'
2+
import React from 'react'
3+
import { instance, mock } from 'ts-mockito'
4+
import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils'
5+
import RedisStackRoutes, { Props } from './RedisStackRoutes'
6+
7+
const mockedProps = mock<Props>()
8+
9+
let store: typeof mockedStore
10+
beforeEach(() => {
11+
cleanup()
12+
store = cloneDeep(mockedStore)
13+
store.clearActions()
14+
})
15+
16+
jest.mock('uiSrc/services', () => ({
17+
...jest.requireActual('uiSrc/services'),
18+
sessionStorageService: {
19+
set: jest.fn(),
20+
get: jest.fn(),
21+
},
22+
}))
23+
24+
describe('RedisStackRoutes', () => {
25+
it('should render', () => {
26+
expect(render(<RedisStackRoutes {...instance(mockedProps)} />)).toBeTruthy()
27+
})
28+
})
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { cloneDeep } from 'lodash'
2+
import React from 'react'
3+
import { instance, mock } from 'ts-mockito'
4+
import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils'
5+
import DefaultErrorContent, { Props } from './DefaultErrorContent'
6+
7+
const mockedProps = mock<Props>()
8+
9+
let store: typeof mockedStore
10+
beforeEach(() => {
11+
cleanup()
12+
store = cloneDeep(mockedStore)
13+
store.clearActions()
14+
})
15+
16+
jest.mock('uiSrc/services', () => ({
17+
...jest.requireActual('uiSrc/services'),
18+
sessionStorageService: {
19+
set: jest.fn(),
20+
get: jest.fn(),
21+
},
22+
}))
23+
24+
describe('DefaultErrorContent', () => {
25+
it('should render', () => {
26+
expect(render(<DefaultErrorContent {...instance(mockedProps)} />)).toBeTruthy()
27+
})
28+
})
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { cloneDeep } from 'lodash'
2+
import React from 'react'
3+
import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils'
4+
import EncryptionErrorContent from './EncryptionErrorContent'
5+
6+
let store: typeof mockedStore
7+
beforeEach(() => {
8+
cleanup()
9+
store = cloneDeep(mockedStore)
10+
store.clearActions()
11+
})
12+
13+
jest.mock('uiSrc/services', () => ({
14+
...jest.requireActual('uiSrc/services'),
15+
sessionStorageService: {
16+
set: jest.fn(),
17+
get: jest.fn(),
18+
},
19+
}))
20+
21+
describe('EncryptionErrorContent', () => {
22+
it('should render', () => {
23+
expect(render(<EncryptionErrorContent />)).toBeTruthy()
24+
})
25+
})
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { cloneDeep } from 'lodash'
2+
import React from 'react'
3+
import { instance, mock } from 'ts-mockito'
4+
import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils'
5+
import QueryCardCliPlugin, { Props } from './QueryCardCliPlugin'
6+
7+
const mockedProps = mock<Props>()
8+
9+
let store: typeof mockedStore
10+
beforeEach(() => {
11+
cleanup()
12+
store = cloneDeep(mockedStore)
13+
store.clearActions()
14+
})
15+
16+
jest.mock('uiSrc/services', () => ({
17+
...jest.requireActual('uiSrc/services'),
18+
sessionStorageService: {
19+
set: jest.fn(),
20+
get: jest.fn(),
21+
},
22+
}))
23+
24+
describe('QueryCardCliPlugin', () => {
25+
it('should render', () => {
26+
expect(render(<QueryCardCliPlugin {...instance(mockedProps)} />)).toBeTruthy()
27+
})
28+
})
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { cloneDeep } from 'lodash'
2+
import React from 'react'
3+
import { instance, mock } from 'ts-mockito'
4+
import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils'
5+
import DedicatedEditor, { Props } from './DedicatedEditor'
6+
7+
const mockedProps = mock<Props>()
8+
9+
let store: typeof mockedStore
10+
beforeEach(() => {
11+
cleanup()
12+
store = cloneDeep(mockedStore)
13+
store.clearActions()
14+
})
15+
16+
jest.mock('uiSrc/services', () => ({
17+
...jest.requireActual('uiSrc/services'),
18+
sessionStorageService: {
19+
set: jest.fn(),
20+
get: jest.fn(),
21+
},
22+
}))
23+
24+
describe('DedicatedEditor', () => {
25+
it('should render', () => {
26+
expect(render(<DedicatedEditor {...instance(mockedProps)} />)).toBeTruthy()
27+
})
28+
})

redisinsight/ui/src/components/query/DedicatedEditor/DedicatedEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const DedicatedEditor = (props: Props) => {
195195
<div className="draggable-area" />
196196
<div className={styles.input} data-testid="query-input-container">
197197
<MonacoEditor
198-
language={selectedLang.id || MonacoLanguage.Cypher}
198+
language={selectedLang?.id || MonacoLanguage.Cypher}
199199
value={value}
200200
onChange={setValue}
201201
options={options}
@@ -204,7 +204,7 @@ const DedicatedEditor = (props: Props) => {
204204
/>
205205
</div>
206206
<div className={cx(styles.actions)}>
207-
<span>{ selectedLang.name }</span>
207+
<span>{ selectedLang?.name }</span>
208208
<div>
209209
<EuiButtonIcon
210210
iconSize="m"

0 commit comments

Comments
 (0)