@@ -5,12 +5,12 @@ import * as rtl from '@testing-library/react'
5
5
import type { Dispatch , ElementType , MouseEvent , ReactNode } from 'react'
6
6
import React , { Component } from 'react'
7
7
import type {
8
- Action ,
9
- AnyAction ,
10
- MiddlewareAPI ,
11
- Dispatch as ReduxDispatch ,
12
- Store ,
13
- UnknownAction ,
8
+ Action ,
9
+ AnyAction ,
10
+ MiddlewareAPI ,
11
+ Dispatch as ReduxDispatch ,
12
+ Store ,
13
+ UnknownAction ,
14
14
} from 'redux'
15
15
import { applyMiddleware , createStore } from 'redux'
16
16
import type { ReactReduxContextValue } from '../../src/index'
@@ -199,7 +199,7 @@ describe('React', () => {
199
199
string : state ,
200
200
} ) ) ( Container )
201
201
202
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
202
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
203
203
204
204
const tester = rtl . render (
205
205
< ProviderMock store = { store } >
@@ -243,7 +243,7 @@ describe('React', () => {
243
243
string : state ,
244
244
} ) ) ( Container )
245
245
246
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
246
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
247
247
const tester = rtl . render (
248
248
< ProviderMock store = { store as unknown as Store } >
249
249
< ConnectedContainer />
@@ -261,7 +261,7 @@ describe('React', () => {
261
261
} )
262
262
263
263
it ( 'should throw an error if the store is not in the props or context' , ( ) => {
264
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
264
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
265
265
266
266
class Container extends Component {
267
267
render ( ) {
@@ -643,7 +643,7 @@ describe('React', () => {
643
643
}
644
644
class AwesomeMap { }
645
645
646
- let spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
646
+ let spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
647
647
rtl . render (
648
648
< ProviderMock store = { store } >
649
649
{ makeContainer (
@@ -660,7 +660,7 @@ describe('React', () => {
660
660
spy . mockRestore ( )
661
661
rtl . cleanup ( )
662
662
663
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
663
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
664
664
rtl . render (
665
665
< ProviderMock store = { store } >
666
666
{ makeContainer (
@@ -677,7 +677,7 @@ describe('React', () => {
677
677
spy . mockRestore ( )
678
678
rtl . cleanup ( )
679
679
680
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
680
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
681
681
rtl . render (
682
682
< ProviderMock store = { store } >
683
683
{ makeContainer (
@@ -694,7 +694,7 @@ describe('React', () => {
694
694
spy . mockRestore ( )
695
695
rtl . cleanup ( )
696
696
697
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
697
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
698
698
rtl . render (
699
699
< ProviderMock store = { store } >
700
700
{ makeContainer (
@@ -711,7 +711,7 @@ describe('React', () => {
711
711
spy . mockRestore ( )
712
712
rtl . cleanup ( )
713
713
714
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
714
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
715
715
rtl . render (
716
716
< ProviderMock store = { store } >
717
717
{ makeContainer (
@@ -728,7 +728,7 @@ describe('React', () => {
728
728
spy . mockRestore ( )
729
729
rtl . cleanup ( )
730
730
731
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
731
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
732
732
rtl . render (
733
733
< ProviderMock store = { store } >
734
734
{ makeContainer (
@@ -745,7 +745,7 @@ describe('React', () => {
745
745
spy . mockRestore ( )
746
746
rtl . cleanup ( )
747
747
748
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
748
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
749
749
rtl . render (
750
750
< ProviderMock store = { store } >
751
751
{ makeContainer (
@@ -762,7 +762,7 @@ describe('React', () => {
762
762
spy . mockRestore ( )
763
763
rtl . cleanup ( )
764
764
765
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
765
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
766
766
rtl . render (
767
767
< ProviderMock store = { store } >
768
768
{ makeContainer (
@@ -779,7 +779,7 @@ describe('React', () => {
779
779
spy . mockRestore ( )
780
780
rtl . cleanup ( )
781
781
782
- spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
782
+ spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
783
783
rtl . render (
784
784
< ProviderMock store = { store } >
785
785
{ makeContainer (
@@ -1297,7 +1297,7 @@ describe('React', () => {
1297
1297
</ ProviderMock > ,
1298
1298
)
1299
1299
1300
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1300
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1301
1301
rtl . act ( ( ) => {
1302
1302
linkA . current ! . click ( )
1303
1303
linkB . current ! . click ( )
@@ -1345,7 +1345,7 @@ describe('React', () => {
1345
1345
)
1346
1346
expect ( mapStateToPropsCalls ) . toBe ( 1 )
1347
1347
1348
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1348
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1349
1349
unmount ( )
1350
1350
expect ( spy ) . toHaveBeenCalledTimes ( 0 )
1351
1351
expect ( mapStateToPropsCalls ) . toBe ( 1 )
@@ -1380,7 +1380,7 @@ describe('React', () => {
1380
1380
} )
1381
1381
1382
1382
expect ( mapStateToPropsCalls ) . toBe ( 1 )
1383
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1383
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
1384
1384
rtl . act ( ( ) => {
1385
1385
store . dispatch ( { type : 'APPEND' , body : 'a' } )
1386
1386
} )
@@ -1456,7 +1456,7 @@ describe('React', () => {
1456
1456
describe ( 'Performance optimizations and bail-outs' , ( ) => {
1457
1457
it ( 'should shallowly compare the selected state to prevent unnecessary updates' , ( ) => {
1458
1458
const store : Store = createStore ( stringBuilder )
1459
- const spy = jest . fn ( ( ) => ( { } ) )
1459
+ const spy = vi . fn ( ( ) => ( { } ) )
1460
1460
interface RenderProps {
1461
1461
string : string
1462
1462
}
@@ -1511,7 +1511,7 @@ describe('React', () => {
1511
1511
1512
1512
it ( 'should shallowly compare the merged state to prevent unnecessary updates' , ( ) => {
1513
1513
const store : Store = createStore ( stringBuilder )
1514
- const spy = jest . fn ( ( ) => ( { } ) )
1514
+ const spy = vi . fn ( ( ) => ( { } ) )
1515
1515
interface PassObjType {
1516
1516
val ?: string
1517
1517
prop ?: string
@@ -2023,7 +2023,7 @@ describe('React', () => {
2023
2023
}
2024
2024
}
2025
2025
2026
- const mapStateToProps = jest . fn ( ( state ) => ( { count : state } ) )
2026
+ const mapStateToProps = vi . fn ( ( state ) => ( { count : state } ) )
2027
2027
2028
2028
interface ChildrenTStateProps {
2029
2029
count : RootStateType
@@ -2089,7 +2089,7 @@ describe('React', () => {
2089
2089
}
2090
2090
type ChildNoDisPatch = { }
2091
2091
type ChildOwnProps = { }
2092
- const mapStateToProps = jest . fn ( ( state ) => ( { count : state } ) )
2092
+ const mapStateToProps = vi . fn ( ( state ) => ( { count : state } ) )
2093
2093
class Child extends Component < ChildTStateProps > {
2094
2094
render ( ) {
2095
2095
return < div > { this . props . count } </ div >
@@ -2284,9 +2284,9 @@ describe('React', () => {
2284
2284
}
2285
2285
type ActionType = UnknownAction
2286
2286
type NoDispatchType = { }
2287
- const c3Spy = jest . fn ( )
2288
- const c2Spy = jest . fn ( )
2289
- const c1Spy = jest . fn ( )
2287
+ const c3Spy = vi . fn ( )
2288
+ const c2Spy = vi . fn ( )
2289
+ const c1Spy = vi . fn ( )
2290
2290
2291
2291
type Comp3TStatePropsType = Store1State1Type
2292
2292
type Comp3NoDispatchType = NoDispatchType
@@ -2442,7 +2442,7 @@ describe('React', () => {
2442
2442
} ,
2443
2443
) ( A )
2444
2444
2445
- const mapStateToPropsB = jest . fn ( ( state ) => ( { count : state } ) )
2445
+ const mapStateToPropsB = vi . fn ( ( state ) => ( { count : state } ) )
2446
2446
class B extends Component {
2447
2447
render ( ) {
2448
2448
return < ConnectedC { ...this . props } />
@@ -2452,7 +2452,7 @@ describe('React', () => {
2452
2452
context : customContext ,
2453
2453
} ) ( B )
2454
2454
2455
- const mapStateToPropsC = jest . fn ( ( state ) => ( { count : state } ) )
2455
+ const mapStateToPropsC = vi . fn ( ( state ) => ( { count : state } ) )
2456
2456
class C extends Component {
2457
2457
render ( ) {
2458
2458
return < ConnectedD />
@@ -2467,7 +2467,7 @@ describe('React', () => {
2467
2467
}
2468
2468
type DNoDispatchType = { }
2469
2469
type DOwnPropsType = { }
2470
- const mapStateToPropsD = jest . fn ( ( state ) => ( { count : state } ) )
2470
+ const mapStateToPropsD = vi . fn ( ( state ) => ( { count : state } ) )
2471
2471
class D extends Component < DTStatePropsType > {
2472
2472
render ( ) {
2473
2473
return < div > { this . props . count } </ div >
@@ -2812,7 +2812,7 @@ describe('React', () => {
2812
2812
describe ( 'Error handling for invalid arguments' , ( ) => {
2813
2813
function renderWithBadConnect ( Component : ElementType ) {
2814
2814
const store = createStore ( ( ) => ( { } ) )
2815
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
2815
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
2816
2816
2817
2817
try {
2818
2818
rtl . render (
@@ -2885,7 +2885,7 @@ describe('React', () => {
2885
2885
if ( ! React . StrictMode ) {
2886
2886
return
2887
2887
}
2888
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
2888
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
2889
2889
const store : Store = createStore ( stringBuilder )
2890
2890
2891
2891
class Container extends Component {
@@ -2917,7 +2917,7 @@ describe('React', () => {
2917
2917
} )
2918
2918
2919
2919
it ( 'should warn one-time-only that `pure` options has been removed' , ( ) => {
2920
- const spy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
2920
+ const spy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
2921
2921
const store : Store = createStore ( stringBuilder )
2922
2922
2923
2923
class ContainerA extends Component {
0 commit comments