@@ -389,12 +389,12 @@ describe('ContractCard', () => {
389
389
expect ( screen . getByText ( 'Accumulators' ) ) . toBeInTheDocument ( ) ;
390
390
expect ( screen . getByText ( symbolName ) ) . toBeInTheDocument ( ) ;
391
391
expect ( screen . getByText ( '9.00 USD' ) ) . toBeInTheDocument ( ) ;
392
- expect ( screen . getByText ( '9/230 ticks' ) ) . toBeInTheDocument ( ) ;
392
+ expect ( screen . getByText ( '9 ticks' ) ) . toBeInTheDocument ( ) ;
393
393
expect ( screen . getByText ( '0.84 USD' ) ) . toBeInTheDocument ( ) ;
394
394
expect ( screen . getByRole ( 'button' , { name : CLOSE } ) ) . toBeEnabled ( ) ;
395
395
expect ( screen . queryByRole ( 'button' , { name : CANCEL } ) ) . not . toBeInTheDocument ( ) ;
396
396
} ) ;
397
- it ( 'should show loader when a Close button is clicked and isSellRequested === true' , ( ) => {
397
+ it ( 'should show loader when a Close button is clicked and isSellRequested === true' , async ( ) => {
398
398
const mockedOnClose = jest . fn ( ) ;
399
399
const { rerender } = render (
400
400
mockedContractCard ( {
@@ -404,7 +404,7 @@ describe('ContractCard', () => {
404
404
} )
405
405
) ;
406
406
const closeButton = screen . getByRole ( 'button' , { name : getCardLabels ( ) . CLOSE } ) ;
407
- userEvent . click ( closeButton ) ;
407
+ await userEvent . click ( closeButton ) ;
408
408
expect ( mockedOnClose ) . toHaveBeenCalledTimes ( 1 ) ;
409
409
410
410
rerender (
@@ -417,7 +417,7 @@ describe('ContractCard', () => {
417
417
expect ( screen . getByTestId ( buttonLoaderId ) ) . toBeInTheDocument ( ) ;
418
418
expect ( closeButton ) . toBeDisabled ( ) ;
419
419
} ) ;
420
- it ( 'should show loader when a Cancel button is clicked and isSellRequested === true' , ( ) => {
420
+ it ( 'should show loader when a Cancel button is clicked and isSellRequested === true' , async ( ) => {
421
421
const mockedOnCancel = jest . fn ( ) ;
422
422
const { rerender } = render (
423
423
mockedContractCard ( {
@@ -427,7 +427,7 @@ describe('ContractCard', () => {
427
427
} )
428
428
) ;
429
429
const cancelButton = screen . getByRole ( 'button' , { name : CANCEL } ) ;
430
- userEvent . click ( cancelButton ) ;
430
+ await userEvent . click ( cancelButton ) ;
431
431
expect ( mockedOnCancel ) . toHaveBeenCalledTimes ( 1 ) ;
432
432
433
433
rerender (
@@ -452,7 +452,7 @@ describe('ContractCard', () => {
452
452
expect ( screen . queryByRole ( 'button' , { name : CLOSE } ) ) . not . toBeInTheDocument ( ) ;
453
453
expect ( screen . queryByRole ( 'button' , { name : CANCEL } ) ) . not . toBeInTheDocument ( ) ;
454
454
} ) ;
455
- it ( 'should call onClick when a card is clicked, and should redirect to a correct route if redirectTo is passed' , ( ) => {
455
+ it ( 'should call onClick when a card is clicked, and should redirect to a correct route if redirectTo is passed' , async ( ) => {
456
456
const mockedOnClick = jest . fn ( ) ;
457
457
const redirectTo = getContractPath ( Number ( closedPositions [ 0 ] . contract_info . contract_id ) ) ;
458
458
render (
@@ -464,11 +464,11 @@ describe('ContractCard', () => {
464
464
} )
465
465
) ;
466
466
const card = screen . getByText ( 'Turbos Up' ) ;
467
- userEvent . click ( card ) ;
467
+ await userEvent . click ( card ) ;
468
468
expect ( mockedOnClick ) . toHaveBeenCalledTimes ( 1 ) ;
469
469
expect ( history . location . pathname ) . toBe ( redirectTo ) ;
470
470
} ) ;
471
- it ( 'should call onClick when a card is clicked, but should not redirect anywhere if redirectTo prop is missing' , ( ) => {
471
+ it ( 'should call onClick when a card is clicked, but should not redirect anywhere if redirectTo prop is missing' , async ( ) => {
472
472
const mockedOnClick = jest . fn ( ) ;
473
473
const redirectTo = getContractPath ( Number ( closedPositions [ 0 ] . contract_info . contract_id ) ) ;
474
474
render (
@@ -479,7 +479,7 @@ describe('ContractCard', () => {
479
479
} )
480
480
) ;
481
481
const card = screen . getByText ( 'Turbos Up' ) ;
482
- userEvent . click ( card ) ;
482
+ await userEvent . click ( card ) ;
483
483
expect ( mockedOnClick ) . toHaveBeenCalledTimes ( 1 ) ;
484
484
expect ( history . location . pathname ) . not . toBe ( redirectTo ) ;
485
485
} ) ;
0 commit comments