@@ -2,26 +2,26 @@ import React from 'react';
2
2
import { BrowserRouter } from 'react-router-dom' ;
3
3
import { fireEvent , render , screen } from '@testing-library/react' ;
4
4
import userEvent from '@testing-library/user-event' ;
5
- import getStatusBadgeConfig from 'Configs /get-status-badge-config' ;
5
+ import getStatusBadgeConfig from '.. /get-status-badge-config' ;
6
6
import { AUTH_STATUS_CODES , MT5_ACCOUNT_STATUS , routes } from '@deriv/shared' ;
7
7
import { TMT5AccountStatus } from 'Types' ;
8
8
9
9
describe ( 'getStatusBadgeConfig' , ( ) => {
10
10
let account_status : TMT5AccountStatus ;
11
- const openFailedVerificationModal = jest . fn ( ) ;
11
+ const openVerificationDocsListModal = jest . fn ( ) ;
12
12
const setIsVerificationModalVisible = jest . fn ( ) ;
13
13
const selected_account_type = 'test type' ;
14
14
15
15
const renderCheck = (
16
16
account_status : Parameters < typeof getStatusBadgeConfig > [ 0 ] ,
17
- openFailedVerificationModal : Parameters < typeof getStatusBadgeConfig > [ 1 ] ,
17
+ openVerificationDocsListModal : Parameters < typeof getStatusBadgeConfig > [ 1 ] ,
18
18
selected_account_type : Parameters < typeof getStatusBadgeConfig > [ 2 ] ,
19
19
setIsVerificationModalVisible ?: Parameters < typeof getStatusBadgeConfig > [ 3 ] ,
20
20
user_account_status ?: Parameters < typeof getStatusBadgeConfig > [ 4 ]
21
21
) => {
22
22
const badge = getStatusBadgeConfig (
23
23
account_status ,
24
- openFailedVerificationModal ,
24
+ openVerificationDocsListModal ,
25
25
selected_account_type ,
26
26
setIsVerificationModalVisible ,
27
27
user_account_status
@@ -37,7 +37,7 @@ describe('getStatusBadgeConfig', () => {
37
37
it ( 'should render pending status' , ( ) => {
38
38
account_status = MT5_ACCOUNT_STATUS . PENDING ;
39
39
40
- renderCheck ( account_status , openFailedVerificationModal , selected_account_type ) ;
40
+ renderCheck ( account_status , openVerificationDocsListModal , selected_account_type ) ;
41
41
42
42
expect ( screen . getByText ( 'Pending verification' ) ) . toBeInTheDocument ( ) ;
43
43
expect ( screen . getByText ( 'IcAlertWarning' ) ) . toBeInTheDocument ( ) ;
@@ -46,19 +46,24 @@ describe('getStatusBadgeConfig', () => {
46
46
it ( 'should render failed status and trigger "Why?"' , ( ) => {
47
47
account_status = MT5_ACCOUNT_STATUS . FAILED ;
48
48
49
- renderCheck ( account_status , openFailedVerificationModal , selected_account_type ) ;
49
+ renderCheck ( account_status , openVerificationDocsListModal , selected_account_type ) ;
50
50
51
51
expect ( screen . getByText ( 'Verification failed.' ) ) . toBeInTheDocument ( ) ;
52
52
expect ( screen . getByText ( 'IcRedWarning' ) ) . toBeInTheDocument ( ) ;
53
53
54
54
fireEvent . click ( screen . getByText ( 'Why?' ) ) ;
55
- expect ( openFailedVerificationModal ) . toBeCalledWith ( selected_account_type ) ;
55
+ expect ( openVerificationDocsListModal ) . toBeCalledWith ( selected_account_type ) ;
56
56
} ) ;
57
57
58
58
it ( 'should render needs_verification status and redirect to identity by default' , ( ) => {
59
59
account_status = MT5_ACCOUNT_STATUS . NEEDS_VERIFICATION ;
60
60
61
- renderCheck ( account_status , openFailedVerificationModal , selected_account_type , setIsVerificationModalVisible ) ;
61
+ renderCheck (
62
+ account_status ,
63
+ openVerificationDocsListModal ,
64
+ selected_account_type ,
65
+ setIsVerificationModalVisible
66
+ ) ;
62
67
63
68
expect ( screen . getByText ( / N e e d s v e r i f i c a t i o n ./ ) ) ;
64
69
expect ( screen . getByText ( 'IcAlertInfo' ) ) ;
@@ -74,7 +79,7 @@ describe('getStatusBadgeConfig', () => {
74
79
it ( 'should render migrated_with_position status' , ( ) => {
75
80
account_status = MT5_ACCOUNT_STATUS . MIGRATED_WITH_POSITION ;
76
81
77
- renderCheck ( account_status , openFailedVerificationModal , selected_account_type ) ;
82
+ renderCheck ( account_status , openVerificationDocsListModal , selected_account_type ) ;
78
83
79
84
expect ( screen . getByText ( 'No new positions' ) ) . toBeInTheDocument ( ) ;
80
85
expect ( screen . getByText ( 'IcAlertWarning' ) ) . toBeInTheDocument ( ) ;
@@ -83,7 +88,7 @@ describe('getStatusBadgeConfig', () => {
83
88
it ( 'should render migrated_without_position status' , ( ) => {
84
89
account_status = MT5_ACCOUNT_STATUS . MIGRATED_WITHOUT_POSITION ;
85
90
86
- renderCheck ( account_status , openFailedVerificationModal , selected_account_type ) ;
91
+ renderCheck ( account_status , openVerificationDocsListModal , selected_account_type ) ;
87
92
88
93
expect ( screen . getByText ( 'Account closed' ) ) . toBeInTheDocument ( ) ;
89
94
expect ( screen . getByText ( 'IcAlertWarning' ) ) . toBeInTheDocument ( ) ;
@@ -92,7 +97,7 @@ describe('getStatusBadgeConfig', () => {
92
97
it ( 'should render need_verification status and redirect to POA when POI is verified' , ( ) => {
93
98
account_status = MT5_ACCOUNT_STATUS . NEEDS_VERIFICATION ;
94
99
95
- renderCheck ( account_status , openFailedVerificationModal , selected_account_type , undefined , {
100
+ renderCheck ( account_status , openVerificationDocsListModal , selected_account_type , undefined , {
96
101
poi_status : AUTH_STATUS_CODES . VERIFIED ,
97
102
poa_status : AUTH_STATUS_CODES . NONE ,
98
103
} ) ;
@@ -109,7 +114,7 @@ describe('getStatusBadgeConfig', () => {
109
114
it ( 'should render need_verification status and redirect to POI when POI status is not verified and POA status is not verified' , ( ) => {
110
115
account_status = MT5_ACCOUNT_STATUS . NEEDS_VERIFICATION ;
111
116
112
- renderCheck ( account_status , openFailedVerificationModal , selected_account_type , undefined , {
117
+ renderCheck ( account_status , openVerificationDocsListModal , selected_account_type , undefined , {
113
118
poi_status : AUTH_STATUS_CODES . NONE ,
114
119
poa_status : AUTH_STATUS_CODES . NONE ,
115
120
} ) ;
0 commit comments