Skip to content

Commit 6124698

Browse files
committed
fix tests
1 parent 967d678 commit 6124698

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import { cloneDeep } from 'lodash'
33
import { instance, mock } from 'ts-mockito'
44

55
import {
6-
fireEvent,
7-
render,
6+
act,
87
cleanup,
8+
fireEvent,
99
mockedStore,
10+
render,
1011
screen,
11-
act,
1212
} from 'uiSrc/utils/test-utils'
1313
import {
1414
getPipelineStrategies,
1515
rdiPipelineStrategiesSelector,
1616
} from 'uiSrc/slices/rdi/pipeline'
1717
import { RdiPipelineTabs } from 'uiSrc/slices/interfaces'
18-
import { NO_TEMPLATE_LABEL, INGEST_OPTION } from './constants'
18+
import { INGEST_OPTION, NO_TEMPLATE_LABEL } from './constants'
1919
import TemplateForm, { Props } from './TemplateForm'
2020

2121
const mockedProps = mock<Props>()
@@ -58,17 +58,18 @@ describe('TemplateForm', () => {
5858

5959
fireEvent.click(screen.getByTestId('template-cancel-btn'))
6060

61-
expect(mockClosePopover).toBeCalled()
61+
expect(mockClosePopover).toHaveBeenCalled()
6262
})
6363

6464
it('should fetch rdi strategies on initial', async () => {
6565
await act(async () => {
6666
render(<TemplateForm {...instance(mockedProps)} />)
6767
})
6868

69-
const expectedActions = [getPipelineStrategies()]
70-
expect(store.getActions().slice(0, expectedActions.length)).toEqual(
71-
expectedActions,
69+
const expectedActions = getPipelineStrategies()
70+
71+
expect(store.getActions()).toEqual(
72+
expect.arrayContaining([expectedActions]),
7273
)
7374
})
7475

redisinsight/ui/src/slices/tests/app/init.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
getFeatureFlags,
2525
getFeatureFlagsFailure,
2626
getFeatureFlagsSuccess,
27+
setFeaturesToHighlight,
2728
} from 'uiSrc/slices/app/features'
2829
import { getConfig } from 'uiSrc/config'
2930
import {
@@ -154,12 +155,17 @@ describe('init slice', () => {
154155
})
155156

156157
it('failed to init csrf', async () => {
157-
riConfig.api.csrfEndpoint = 'http://localhost/csrf'
158+
riConfig.api.csrfEndpoint = 'csrf'
158159
mswServer.use(
159160
http.get<any, CSRFTokenResponse>(
160161
getMswURL(riConfig.api.csrfEndpoint),
161162
async () => {
162-
return HttpResponse.text('', { status: 500 })
163+
return HttpResponse.json(
164+
{
165+
message: 'Network Error',
166+
},
167+
{ status: 500 },
168+
)
163169
},
164170
),
165171
)

0 commit comments

Comments
 (0)