1
1
import injectorFactory from './injectorFactory' ;
2
2
import { processRoute } from '~core/router' ;
3
3
4
- jest . mock ( '~core/router' , ( ) => ( {
5
- processRoute : jest . fn ( ) . mockReturnValue ( 'processRouteMockedReturnValue' ) ,
4
+ vi . mock ( '~core/router' , ( ) => ( {
5
+ processRoute : vi . fn ( ) . mockReturnValue ( 'processRouteMockedReturnValue' ) ,
6
6
} ) ) ;
7
7
8
8
describe ( 'injectorFactory' , ( ) => {
9
9
describe ( '#watch()' , ( ) => {
10
10
it ( 'should add callback as new watcher for passed property' , ( ) => {
11
11
const core = { watchers : { } , state : { foo : 'bar' } } ;
12
12
const injector = injectorFactory ( core ) ;
13
- const cb = jest . fn ( ) ;
13
+ const cb = vi . fn ( ) ;
14
14
15
15
injector . watch ( 'foo' , cb ) ;
16
16
core . watchers . foo [ 0 ] ( ) ;
@@ -21,7 +21,7 @@ describe('injectorFactory', () => {
21
21
it ( 'should add immediate callback call' , ( ) => {
22
22
const core = { watchers : { } , state : { foo : 'bar' } } ;
23
23
const injector = injectorFactory ( core ) ;
24
- const cb = jest . fn ( ) ;
24
+ const cb = vi . fn ( ) ;
25
25
26
26
injector . watch ( 'foo' , cb , { immediate : true } ) ;
27
27
@@ -31,7 +31,7 @@ describe('injectorFactory', () => {
31
31
it ( 'should add immediate callback call with "*" key' , ( ) => {
32
32
const core = { watchers : { } , state : { foo : 'bar' } } ;
33
33
const injector = injectorFactory ( core ) ;
34
- const cb = jest . fn ( ) ;
34
+ const cb = vi . fn ( ) ;
35
35
36
36
injector . watch ( '*' , cb , { immediate : true } ) ;
37
37
@@ -45,7 +45,7 @@ describe('injectorFactory', () => {
45
45
} ;
46
46
47
47
const injector = injectorFactory ( core ) ;
48
- const cb = jest . fn ( ) ;
48
+ const cb = vi . fn ( ) ;
49
49
50
50
injector . watch ( 'foo' , cb ) ;
51
51
core . watchers . foo [ 1 ] ( ) ;
@@ -60,7 +60,7 @@ describe('injectorFactory', () => {
60
60
} ;
61
61
62
62
const injector = injectorFactory ( core ) ;
63
- const cb = jest . fn ( ) ;
63
+ const cb = vi . fn ( ) ;
64
64
65
65
injector . watch ( cb ) ;
66
66
core . watchers [ '*' ] [ 0 ] ( ) ;
@@ -74,10 +74,10 @@ describe('injectorFactory', () => {
74
74
let commit ;
75
75
76
76
beforeEach ( ( ) => {
77
- global . window . top . postMessage = jest . fn ( ) ;
77
+ global . window . top . postMessage = vi . fn ( ) ;
78
78
79
79
core = {
80
- assign : jest . fn ( ) ,
80
+ assign : vi . fn ( ) ,
81
81
id : 'XXX' ,
82
82
state : {
83
83
foo : 'bar' ,
@@ -124,7 +124,7 @@ describe('injectorFactory', () => {
124
124
125
125
describe ( '#emit()' , ( ) => {
126
126
beforeEach ( ( ) => {
127
- global . window . top . postMessage = jest . fn ( ) ;
127
+ global . window . top . postMessage = vi . fn ( ) ;
128
128
} ) ;
129
129
130
130
it ( 'should emit proper event' , ( ) => {
@@ -173,7 +173,7 @@ describe('injectorFactory', () => {
173
173
describe ( '#listen()' , ( ) => {
174
174
it ( 'should put provided callback to proper listeners' , ( ) => {
175
175
const core = { listeners : { } } ;
176
- const cb = jest . fn ( ) ;
176
+ const cb = vi . fn ( ) ;
177
177
injectorFactory ( core ) . listen ( 'foo' , cb ) ;
178
178
core . listeners . foo ( ) ;
179
179
@@ -187,7 +187,7 @@ describe('injectorFactory', () => {
187
187
188
188
beforeEach ( ( ) => {
189
189
injector = injectorFactory ( { } ) ;
190
- injectorEmitSpy = jest . spyOn ( injector , 'emit' ) ;
190
+ injectorEmitSpy = vi . spyOn ( injector , 'emit' ) ;
191
191
} ) ;
192
192
193
193
it ( 'calls processRoute with the given arguments' , ( ) => {
0 commit comments