@@ -28,6 +28,8 @@ function renderWithProps(props = {}) {
2828} 
2929
3030describe ( 'ValidatorDetailsModal Component' ,  ( )  =>  { 
31+   const  TIMEOUT  =  30000 ; 
32+ 
3133  beforeEach ( ( )  =>  { 
3234    mockRouter ( ) ; 
3335  } ) ; 
@@ -36,105 +38,149 @@ describe('ValidatorDetailsModal Component', () => {
3638    clearAllMocks ( ) ; 
3739  } ) ; 
3840
39-   test ( 'renders modal with correct details' ,  ( )  =>  { 
40-     renderWithProps ( ) ; 
41-     expect ( screen . getByText ( 'Validator Details' ) ) . toBeInTheDocument ( ) ; 
42-     expect ( screen . getByText ( 'Validator One' ) ) . toBeInTheDocument ( ) ; 
43-     expect ( screen . getByText ( 'security1@foobar.com' ) ) . toBeInTheDocument ( ) ; 
44-     const  detailsContainer  =  screen . getByLabelText ( 'details' ) ; 
45-     expect ( within ( detailsContainer ) . getByText ( 'details1' ) ) . toBeInTheDocument ( ) ; 
46-   } ) ; 
41+   test ( 
42+     'renders modal with correct details' , 
43+     ( )  =>  { 
44+       renderWithProps ( ) ; 
45+       expect ( screen . getByText ( 'Validator Details' ) ) . toBeInTheDocument ( ) ; 
46+       expect ( screen . getByText ( 'Validator One' ) ) . toBeInTheDocument ( ) ; 
47+       expect ( screen . getByText ( 'security1@foobar.com' ) ) . toBeInTheDocument ( ) ; 
48+       const  detailsContainer  =  screen . getByLabelText ( 'details' ) ; 
49+       expect ( within ( detailsContainer ) . getByText ( 'details1' ) ) . toBeInTheDocument ( ) ; 
50+     } , 
51+     TIMEOUT 
52+   ) ; 
4753
48-   test ( 'updates input field correctly' ,  async  ( )  =>  { 
49-     renderWithProps ( ) ; 
50-     const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
51-     fireEvent . change ( input ,  {  target : {  value : '2000'  }  } ) ; 
52-     await  waitFor ( ( )  =>  { 
53-       expect ( input ) . toHaveValue ( 2000 ) ; 
54-     } ) ; 
55-   } ) ; 
54+   test ( 
55+     'updates input field correctly' , 
56+     async  ( )  =>  { 
57+       renderWithProps ( ) ; 
58+       const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
59+       fireEvent . change ( input ,  {  target : {  value : '2000'  }  } ) ; 
60+       await  waitFor ( ( )  =>  { 
61+         expect ( input ) . toHaveValue ( 2000 ) ; 
62+       } ) ; 
63+     } , 
64+     TIMEOUT 
65+   ) ; 
5666
57-   test ( 'enables upgrade button when input is valid' ,  async  ( )  =>  { 
58-     renderWithProps ( ) ; 
59-     const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
60-     fireEvent . change ( input ,  {  target : {  value : '2000'  }  } ) ; 
61-     await  waitFor ( ( )  =>  { 
62-       const  updateButton  =  screen . getByText ( 'Update' ) ; 
63-       expect ( updateButton ) . not . toBeDisabled ( ) ; 
64-     } ) ; 
65-   } ) ; 
67+   test ( 
68+     'enables upgrade button when input is valid' , 
69+     async  ( )  =>  { 
70+       renderWithProps ( ) ; 
71+       const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
72+       fireEvent . change ( input ,  {  target : {  value : '2000'  }  } ) ; 
73+       await  waitFor ( ( )  =>  { 
74+         const  updateButton  =  screen . getByText ( 'Update' ) ; 
75+         expect ( updateButton ) . not . toBeDisabled ( ) ; 
76+       } ) ; 
77+     } , 
78+     TIMEOUT 
79+   ) ; 
6680
67-   test ( 'disables upgrade button when input is invalid' ,  async  ( )  =>  { 
68-     renderWithProps ( ) ; 
69-     const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
70-     fireEvent . change ( input ,  {  target : {  value : '-1'  }  } ) ; 
71-     fireEvent . blur ( input ) ; 
72-     await  waitFor ( ( )  =>  { 
73-       const  updateButton  =  screen . getByText ( 'Update' ) ; 
74-       expect ( updateButton ) . toBeDisabled ( ) ; 
75-     } ) ; 
76-   } ) ; 
81+   test ( 
82+     'disables upgrade button when input is invalid' , 
83+     async  ( )  =>  { 
84+       renderWithProps ( ) ; 
85+       const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
86+       fireEvent . change ( input ,  {  target : {  value : '-1'  }  } ) ; 
87+       fireEvent . blur ( input ) ; 
88+       await  waitFor ( ( )  =>  { 
89+         const  updateButton  =  screen . getByText ( 'Update' ) ; 
90+         expect ( updateButton ) . toBeDisabled ( ) ; 
91+       } ) ; 
92+     } , 
93+     TIMEOUT 
94+   ) ; 
7795
78-   test ( 'shows error message for invalid power input' ,  async  ( )  =>  { 
79-     renderWithProps ( ) ; 
80-     const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
81-     fireEvent . change ( input ,  {  target : {  value : '-1'  }  } ) ; 
82-     fireEvent . blur ( input ) ; 
83-     await  waitFor ( ( )  =>  { 
84-       const  errorMessage  =  screen . getByText ( 
85-         ( _content ,  element )  => 
86-           ( element  as  HTMLElement ) ?. dataset ?. tip  ===  'Power must be greater than 0' 
87-       ) ; 
88-       expect ( errorMessage ) . toBeInTheDocument ( ) ; 
89-     } ) ; 
90-   } ) ; 
96+   test ( 
97+     'shows error message for invalid power input' , 
98+     async  ( )  =>  { 
99+       renderWithProps ( ) ; 
100+       const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
101+       fireEvent . change ( input ,  {  target : {  value : '-1'  }  } ) ; 
102+       fireEvent . blur ( input ) ; 
103+       await  waitFor ( ( )  =>  { 
104+         const  errorMessage  =  screen . getByText ( 
105+           ( _content ,  element )  => 
106+             ( element  as  HTMLElement ) ?. dataset ?. tip  ===  'Power must be greater than 0' 
107+         ) ; 
108+         expect ( errorMessage ) . toBeInTheDocument ( ) ; 
109+       } ) ; 
110+     } , 
111+     TIMEOUT 
112+   ) ; 
91113
92-   test ( 'shows warning message for unsafe power upgrade' ,  async  ( )  =>  { 
93-     renderWithProps ( ) ; 
94-     const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
95-     fireEvent . change ( input ,  {  target : {  value : '9000'  }  } ) ; 
96-     fireEvent . blur ( input ) ; 
97-     await  waitFor ( ( )  =>  { 
98-       const  warningMessage  =  screen . getByText ( / W a r n i n g :   T h i s   p o w e r   u p d a t e   m a y   b e   u n s a f e / i) ; 
99-       expect ( warningMessage ) . toBeInTheDocument ( ) ; 
100-     } ) ; 
101-   } ) ; 
114+   test ( 
115+     'shows warning message for unsafe power upgrade' , 
116+     async  ( )  =>  { 
117+       renderWithProps ( ) ; 
118+       const  input  =  screen . getByPlaceholderText ( '1000' ) ; 
119+       fireEvent . change ( input ,  {  target : {  value : '9000'  }  } ) ; 
120+       fireEvent . blur ( input ) ; 
121+       await  waitFor ( ( )  =>  { 
122+         const  warningMessage  =  screen . getByText ( / W a r n i n g :   T h i s   p o w e r   u p d a t e   m a y   b e   u n s a f e / i) ; 
123+         expect ( warningMessage ) . toBeInTheDocument ( ) ; 
124+       } ) ; 
125+     } , 
126+     TIMEOUT 
127+   ) ; 
102128
103-   test ( 'show banner when hasUnbonding is true (active)' ,  ( )  =>  { 
104-     renderWithProps ( {  hasUnbonding : true  } ) ; 
129+   test ( 
130+     'show banner when hasUnbonding is true (active)' , 
131+     ( )  =>  { 
132+       renderWithProps ( {  hasUnbonding : true  } ) ; 
105133
106-     expect ( 
107-       screen . queryByText ( / Y o u   c a n n o t   u p d a t e   v a l i d a t o r   p o w e r   w h i l e   v a l i d a t o r \( s \)   a r e   u n b o n d i n g \. / i) 
108-     ) . toBeInTheDocument ( ) ; 
134+       expect ( 
135+         screen . queryByText ( 
136+           / Y o u   c a n n o t   u p d a t e   v a l i d a t o r   p o w e r   w h i l e   v a l i d a t o r \( s \)   a r e   u n b o n d i n g \. / i
137+         ) 
138+       ) . toBeInTheDocument ( ) ; 
109139
110-     const  updateButton  =  screen . getByText ( 'Update' ) ; 
111-     expect ( updateButton ) . toBeDisabled ( ) ; 
112-   } ) ; 
140+       const  updateButton  =  screen . getByText ( 'Update' ) ; 
141+       expect ( updateButton ) . toBeDisabled ( ) ; 
142+     } , 
143+     TIMEOUT 
144+   ) ; 
113145
114-   test ( 'show banner when hasUnbonding is true (pending)' ,  ( )  =>  { 
115-     renderWithProps ( {  validator : mockPendingValidators [ 0 ] ,  hasUnbonding : true  } ) ; 
146+   test ( 
147+     'show banner when hasUnbonding is true (pending)' , 
148+     ( )  =>  { 
149+       renderWithProps ( {  validator : mockPendingValidators [ 0 ] ,  hasUnbonding : true  } ) ; 
116150
117-     expect ( 
118-       screen . queryByText ( / Y o u   c a n n o t   u p d a t e   v a l i d a t o r   p o w e r   w h i l e   v a l i d a t o r \( s \)   a r e   u n b o n d i n g \. / i) 
119-     ) . toBeInTheDocument ( ) ; 
151+       expect ( 
152+         screen . queryByText ( 
153+           / Y o u   c a n n o t   u p d a t e   v a l i d a t o r   p o w e r   w h i l e   v a l i d a t o r \( s \)   a r e   u n b o n d i n g \. / i
154+         ) 
155+       ) . toBeInTheDocument ( ) ; 
120156
121-     const  updateButton  =  screen . getByText ( 'Update' ) ; 
122-     expect ( updateButton ) . toBeDisabled ( ) ; 
123-   } ) ; 
157+       const  updateButton  =  screen . getByText ( 'Update' ) ; 
158+       expect ( updateButton ) . toBeDisabled ( ) ; 
159+     } , 
160+     TIMEOUT 
161+   ) ; 
124162
125-   test ( 'shows UNBONDING TIME and hides POWER when unbonding_time is set' ,  ( )  =>  { 
126-     renderWithProps ( {  validator : mockUnbondingValidators [ 0 ] ,  hasUnbonding : true  } ) ; 
163+   test ( 
164+     'shows UNBONDING TIME and hides POWER when unbonding_time is set' , 
165+     ( )  =>  { 
166+       renderWithProps ( {  validator : mockUnbondingValidators [ 0 ] ,  hasUnbonding : true  } ) ; 
127167
128-     expect ( screen . getByText ( 'UNBONDING TIME (UTC)' ) ) . toBeInTheDocument ( ) ; 
129-     expect ( screen . queryByText ( 'POWER' ) ) . not . toBeInTheDocument ( ) ; 
130-     expect ( screen . queryByText ( 'Update' ) ) . not . toBeInTheDocument ( ) ; 
131-   } ) ; 
168+       expect ( screen . getByText ( 'UNBONDING TIME (UTC)' ) ) . toBeInTheDocument ( ) ; 
169+       expect ( screen . queryByText ( 'POWER' ) ) . not . toBeInTheDocument ( ) ; 
170+       expect ( screen . queryByText ( 'Update' ) ) . not . toBeInTheDocument ( ) ; 
171+     } , 
172+     TIMEOUT 
173+   ) ; 
132174
133-   test ( 'ignores Unix epoch 0 unbonding_time and shows POWER' ,  ( )  =>  { 
134-     renderWithProps ( { } ) ; 
175+   test ( 
176+     'ignores Unix epoch 0 unbonding_time and shows POWER' , 
177+     ( )  =>  { 
178+       renderWithProps ( { } ) ; 
135179
136-     expect ( screen . queryByText ( 'UNBONDING TIME (UTC)' ) ) . not . toBeInTheDocument ( ) ; 
137-     expect ( screen . getByText ( 'POWER' ) ) . toBeInTheDocument ( ) ; 
138-     expect ( screen . getByText ( 'Update' ) ) . toBeInTheDocument ( ) ; 
139-   } ) ; 
180+       expect ( screen . queryByText ( 'UNBONDING TIME (UTC)' ) ) . not . toBeInTheDocument ( ) ; 
181+       expect ( screen . getByText ( 'POWER' ) ) . toBeInTheDocument ( ) ; 
182+       expect ( screen . getByText ( 'Update' ) ) . toBeInTheDocument ( ) ; 
183+     } , 
184+     TIMEOUT 
185+   ) ; 
140186} ) ; 
0 commit comments