@@ -82,7 +82,7 @@ test('not specified --target and --targetPaths', async () => {
82
82
83
83
test ( '--target option' , async ( ) => {
84
84
// setup mocks
85
- mockPush . mockImplementation ( resource => true )
85
+ mockPush . mockImplementation ( ( { resource } ) => true )
86
86
87
87
// run
88
88
const push = await import ( '../../src/commands/push' )
@@ -94,16 +94,20 @@ test('--target option', async () => {
94
94
} )
95
95
96
96
expect ( mockPush ) . toHaveBeenCalledWith ( {
97
- messages : {
98
- en : { hello : 'world' }
97
+ resource : {
98
+ messages : {
99
+ en : { hello : 'world' }
100
+ } ,
101
+ mode : 'locale-message'
99
102
} ,
100
- mode : 'locale-message'
101
- } , false , undefined )
103
+ dryRun : false ,
104
+ normalize : undefined
105
+ } )
102
106
} )
103
107
104
108
test ( '--locale option' , async ( ) => {
105
109
// setup mocks
106
- mockPush . mockImplementation ( resource => true )
110
+ mockPush . mockImplementation ( ( { resource } ) => true )
107
111
108
112
// run
109
113
const push = await import ( '../../src/commands/push' )
@@ -115,16 +119,20 @@ test('--locale option', async () => {
115
119
} )
116
120
117
121
expect ( mockPush ) . toHaveBeenCalledWith ( {
118
- messages : {
119
- ja : { hello : '世界' }
122
+ resource : {
123
+ messages : {
124
+ ja : { hello : '世界' }
125
+ } ,
126
+ mode : 'locale-message'
120
127
} ,
121
- mode : 'locale-message'
122
- } , false , undefined )
128
+ dryRun : false ,
129
+ normalize : undefined
130
+ } )
123
131
} )
124
132
125
133
test ( '--conf option' , async ( ) => {
126
134
// setup mocks
127
- mockPush . mockImplementation ( reosurce => true )
135
+ mockPush . mockImplementation ( ( { reosurce } ) => true )
128
136
129
137
// run
130
138
const TARGET_LOCALE = './test/fixtures/locales/en.json'
@@ -141,12 +149,16 @@ test('--conf option', async () => {
141
149
pushMode : 'file-path'
142
150
} )
143
151
expect ( mockPush ) . toHaveBeenCalledWith ( {
144
- files : [ {
145
- locale : 'en' ,
146
- path : path . resolve ( TARGET_LOCALE )
147
- } ] ,
148
- mode : 'file-path'
149
- } , false , undefined )
152
+ resource : {
153
+ files : [ {
154
+ locale : 'en' ,
155
+ path : path . resolve ( TARGET_LOCALE )
156
+ } ] ,
157
+ mode : 'file-path'
158
+ } ,
159
+ dryRun : false ,
160
+ normalize : undefined
161
+ } )
150
162
} )
151
163
152
164
test ( '--conf option omit' , async ( ) => {
@@ -168,7 +180,7 @@ test('--conf option omit', async () => {
168
180
169
181
test ( '--target-paths option' , async ( ) => {
170
182
// setup mocks
171
- mockPush . mockImplementation ( resource => true )
183
+ mockPush . mockImplementation ( ( { resource } ) => true )
172
184
173
185
// run
174
186
const push = await import ( '../../src/commands/push' )
@@ -180,25 +192,29 @@ test('--target-paths option', async () => {
180
192
} )
181
193
182
194
expect ( mockPush ) . toHaveBeenCalledWith ( {
183
- messages : {
184
- en : {
185
- hello : 'world'
195
+ resource : {
196
+ messages : {
197
+ en : {
198
+ hello : 'world'
199
+ } ,
200
+ lang : {
201
+ hello : '世界'
202
+ } ,
203
+ ja : {
204
+ hello : 'こんにちわわわ!' ,
205
+ world : 'ザ・ワールド'
206
+ }
186
207
} ,
187
- lang : {
188
- hello : '世界'
189
- } ,
190
- ja : {
191
- hello : 'こんにちわわわ!' ,
192
- world : 'ザ・ワールド'
193
- }
208
+ mode : 'locale-message'
194
209
} ,
195
- mode : 'locale-message'
196
- } , false , undefined )
210
+ dryRun : false ,
211
+ normalize : undefined
212
+ } )
197
213
} )
198
214
199
215
test ( 'not specified --filename-match' , async ( ) => {
200
216
// setup mocks
201
- mockPush . mockImplementation ( resource => true )
217
+ mockPush . mockImplementation ( ( { resource } ) => true )
202
218
203
219
// run
204
220
const push = await import ( '../../src/commands/push' )
@@ -214,7 +230,7 @@ test('not specified --filename-match', async () => {
214
230
215
231
test ( '--dry-run option' , async ( ) => {
216
232
// setup mocks
217
- mockPush . mockImplementation ( resource => false )
233
+ mockPush . mockImplementation ( ( { resource } ) => false )
218
234
219
235
// run
220
236
const push = await import ( '../../src/commands/push' )
@@ -226,16 +242,20 @@ test('--dry-run option', async () => {
226
242
} )
227
243
228
244
expect ( mockPush ) . toHaveBeenCalledWith ( {
229
- messages : {
230
- ja : { hello : '世界' }
245
+ resource : {
246
+ messages : {
247
+ ja : { hello : '世界' }
248
+ } ,
249
+ mode : 'locale-message'
231
250
} ,
232
- mode : 'locale-message'
233
- } , true , undefined )
251
+ dryRun : true ,
252
+ normalize : undefined
253
+ } )
234
254
} )
235
255
236
256
test ( '--normalize option' , async ( ) => {
237
257
// setup mocks
238
- mockPush . mockImplementation ( resource => false )
258
+ mockPush . mockImplementation ( ( { resource } ) => false )
239
259
240
260
// run
241
261
const push = await import ( '../../src/commands/push' )
@@ -247,9 +267,13 @@ test('--normalize option', async () => {
247
267
} )
248
268
249
269
expect ( mockPush ) . toHaveBeenCalledWith ( {
250
- messages : {
251
- ja : { hello : '世界' }
270
+ resource : {
271
+ messages : {
272
+ ja : { hello : '世界' }
273
+ } ,
274
+ mode : 'locale-message'
252
275
} ,
253
- mode : 'locale-message'
254
- } , false , 'flat' )
276
+ dryRun : false ,
277
+ normalize : 'flat'
278
+ } )
255
279
} )
0 commit comments