1
1
import { expect } from 'chai' ;
2
- import makeMenuRetistry from '../src/menuRegistry' ;
2
+
3
+ jest . dontMock ( '../src/menuRegistry' ) ;
4
+ const makeMenuRegistry = require ( '../src/menuRegistry' ) . default ;
3
5
4
6
describe ( 'menuRegistry tests' , ( ) => {
5
7
@@ -18,26 +20,26 @@ describe('menuRegistry tests', () => {
18
20
} ;
19
21
20
22
it ( 'should export function' , ( ) => {
21
- expect ( makeMenuRetistry ) . to . be . a ( 'function' ) ;
23
+ expect ( makeMenuRegistry ) . to . be . a ( 'function' ) ;
22
24
} ) ;
23
25
24
26
it ( 'should create an object' , ( ) => {
25
- expect ( makeMenuRetistry ( new Map ( ) ) ) . to . be . an ( 'object' ) ;
27
+ expect ( makeMenuRegistry ( new Map ( ) ) ) . to . be . an ( 'object' ) ;
26
28
} ) ;
27
29
28
30
describe ( 'getMenu' , ( ) => {
29
31
it ( 'should return menu' , ( ) => {
30
32
const menus = new Map ( [
31
33
[ menu1 . name , menu1 ]
32
34
] ) ;
33
- const registry = makeMenuRetistry ( menus ) ;
35
+ const registry = makeMenuRegistry ( menus ) ;
34
36
expect ( registry . getMenu ( menu1 . name ) ) . to . eql ( menu1 ) ;
35
37
} ) ;
36
38
} ) ;
37
39
38
40
describe ( 'subscribe' , ( ) => {
39
41
it ( 'should subscribe menu' , ( ) => {
40
- const registry = makeMenuRetistry ( ) ;
42
+ const registry = makeMenuRegistry ( ) ;
41
43
registry . subscribe ( menu1 . name , menu1 ) ;
42
44
expect ( registry . getMenu ( menu1 . name ) ) . to . eql ( menu1 ) ;
43
45
} ) ;
@@ -49,7 +51,7 @@ describe('menuRegistry tests', () => {
49
51
[ menu1 . name , menu1 ] ,
50
52
[ menu2 . name , menu2 ]
51
53
] ) ;
52
- const registry = makeMenuRetistry ( menus ) ;
54
+ const registry = makeMenuRegistry ( menus ) ;
53
55
registry . unsubscribe ( menu1 . name ) ;
54
56
expect ( registry . getMenu ( menu1 . name ) ) . to . be . undefined ;
55
57
expect ( registry . getMenu ( menu2 . name ) ) . to . eql ( menu2 ) ;
@@ -66,7 +68,7 @@ describe('menuRegistry tests', () => {
66
68
triggerLayout : 5 ,
67
69
optionsLayout : 6
68
70
} ] ] ) ;
69
- const registry = makeMenuRetistry ( menus ) ;
71
+ const registry = makeMenuRegistry ( menus ) ;
70
72
registry . update ( 'menu3' , {
71
73
options : [ 7 , 8 ] ,
72
74
trigger : 'trigger3x' ,
@@ -91,7 +93,7 @@ describe('menuRegistry tests', () => {
91
93
triggerLayout : 5 ,
92
94
optionsLayout : 6
93
95
} ] ] ) ;
94
- const registry = makeMenuRetistry ( menus ) ;
96
+ const registry = makeMenuRegistry ( menus ) ;
95
97
registry . updateLayoutInfo ( 'menu3' , { optionsLayout : 7 } ) ;
96
98
expect ( registry . getMenu ( 'menu3' ) ) . to . eql ( {
97
99
name : 'menu3' ,
@@ -106,7 +108,7 @@ describe('menuRegistry tests', () => {
106
108
triggerLayout : 5 ,
107
109
optionsLayout : 6
108
110
} ] ] ) ;
109
- const registry = makeMenuRetistry ( menus ) ;
111
+ const registry = makeMenuRegistry ( menus ) ;
110
112
registry . updateLayoutInfo ( 'menu3' , { triggerLayout : 7 } ) ;
111
113
expect ( registry . getMenu ( 'menu3' ) ) . to . eql ( {
112
114
name : 'menu3' ,
0 commit comments