@@ -70,6 +70,26 @@ describe('jest-each', () => {
70
70
expect ( testCallBack ) . not . toHaveBeenCalled ( ) ;
71
71
} ) ;
72
72
73
+ test ( 'does not throw error when there are multibyte characters in first column headings' , ( ) => {
74
+ const globalTestMocks = getGlobalTestMocks ( ) ;
75
+ const eachObject = each . withGlobal ( globalTestMocks ) `
76
+ ʅ(ツ)ʃ | b | expected
77
+ ${ 1 } | ${ 1 } | ${ 2 }
78
+ ` ;
79
+ const testFunction = get ( eachObject , keyPath ) ;
80
+ const testCallBack = jest . fn ( ) ;
81
+ testFunction ( 'accept multibyte characters' , testCallBack ) ;
82
+
83
+ const globalMock = get ( globalTestMocks , keyPath ) ;
84
+
85
+ expect ( ( ) => globalMock . mock . calls [ 0 ] [ 1 ] ( ) ) . not . toThrowError ( ) ;
86
+ expect ( testCallBack ) . toHaveBeenCalledWith ( {
87
+ b : 1 ,
88
+ expected : 2 ,
89
+ 'ʅ(ツ)ʃ' : 1 ,
90
+ } ) ;
91
+ } ) ;
92
+
73
93
test ( 'throws error when there are additional words in second column heading' , ( ) => {
74
94
const globalTestMocks = getGlobalTestMocks ( ) ;
75
95
const eachObject = each . withGlobal ( globalTestMocks ) `
@@ -88,6 +108,26 @@ describe('jest-each', () => {
88
108
expect ( testCallBack ) . not . toHaveBeenCalled ( ) ;
89
109
} ) ;
90
110
111
+ test ( 'does not throw error when there are multibyte characters in second column headings' , ( ) => {
112
+ const globalTestMocks = getGlobalTestMocks ( ) ;
113
+ const eachObject = each . withGlobal ( globalTestMocks ) `
114
+ a | ☝(ʕ⊙ḕ⊙ʔ)☝ | expected
115
+ ${ 1 } | ${ 1 } | ${ 2 }
116
+ ` ;
117
+ const testFunction = get ( eachObject , keyPath ) ;
118
+ const testCallBack = jest . fn ( ) ;
119
+ testFunction ( 'accept multibyte characters' , testCallBack ) ;
120
+
121
+ const globalMock = get ( globalTestMocks , keyPath ) ;
122
+
123
+ expect ( ( ) => globalMock . mock . calls [ 0 ] [ 1 ] ( ) ) . not . toThrowError ( ) ;
124
+ expect ( testCallBack ) . toHaveBeenCalledWith ( {
125
+ a : 1 ,
126
+ expected : 2 ,
127
+ '☝(ʕ⊙ḕ⊙ʔ)☝' : 1 ,
128
+ } ) ;
129
+ } ) ;
130
+
91
131
test ( 'throws error when there are additional words in last column heading' , ( ) => {
92
132
const globalTestMocks = getGlobalTestMocks ( ) ;
93
133
const eachObject = each . withGlobal ( globalTestMocks ) `
@@ -106,6 +146,26 @@ describe('jest-each', () => {
106
146
expect ( testCallBack ) . not . toHaveBeenCalled ( ) ;
107
147
} ) ;
108
148
149
+ test ( 'does not throw error when there are multibyte characters in last column headings' , ( ) => {
150
+ const globalTestMocks = getGlobalTestMocks ( ) ;
151
+ const eachObject = each . withGlobal ( globalTestMocks ) `
152
+ a | b | (๑ఠ‿ఠ๑)<expected
153
+ ${ 1 } | ${ 1 } | ${ 2 }
154
+ ` ;
155
+ const testFunction = get ( eachObject , keyPath ) ;
156
+ const testCallBack = jest . fn ( ) ;
157
+ testFunction ( 'accept multibyte characters' , testCallBack ) ;
158
+
159
+ const globalMock = get ( globalTestMocks , keyPath ) ;
160
+
161
+ expect ( ( ) => globalMock . mock . calls [ 0 ] [ 1 ] ( ) ) . not . toThrowError ( ) ;
162
+ expect ( testCallBack ) . toHaveBeenCalledWith ( {
163
+ '(๑ఠ‿ఠ๑)<expected' : 2 ,
164
+ a : 1 ,
165
+ b : 1 ,
166
+ } ) ;
167
+ } ) ;
168
+
109
169
test ( 'does not throw error when there is additional words in template after heading row' , ( ) => {
110
170
const globalTestMocks = getGlobalTestMocks ( ) ;
111
171
const eachObject = each . withGlobal ( globalTestMocks ) `
0 commit comments