File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ export const handler = async (args: Arguments<ListOptions>): Promise<unknown> =>
124
124
125
125
const unflattedLocaleMessages = { } as LocaleMessages
126
126
Object . keys ( flattedLocaleMessages ) . forEach ( locale => {
127
- unflattedLocaleMessages [ locale ] = unflatten ( flattedLocaleMessages [ locale ] )
127
+ unflattedLocaleMessages [ locale ] = unflatten ( flattedLocaleMessages [ locale ] , { object : true } )
128
128
} )
129
129
130
130
await tweakLocaleMessages ( unflattedLocaleMessages , args )
Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ test('--define option', async () => {
143
143
mockUtils . getLocaleMessages . mockImplementation ( ( ...args ) => ( {
144
144
en : {
145
145
foo : 'foo' ,
146
- bar : { buz : 'buz' }
146
+ bar : { buz : 'buz' } ,
147
+ buz : {
148
+ inedexed : { '1' : 'low' , '10' : 'middle' , '20' : 'high' }
149
+ }
147
150
} ,
148
151
ja : { }
149
152
} ) )
@@ -164,12 +167,18 @@ test('--define option', async () => {
164
167
await flash ( )
165
168
166
169
// verify
167
- expect ( spyLog ) . toHaveBeenCalledTimes ( 3 )
170
+ expect ( spyLog ) . toHaveBeenCalledTimes ( 6 )
168
171
expect ( spyLog . mock . calls [ 0 ] ) . toEqual ( [ `ja: 'foo' undefined` ] )
169
172
expect ( spyLog . mock . calls [ 1 ] ) . toEqual ( [ `ja: 'bar.buz' undefined` ] )
173
+ expect ( spyLog . mock . calls [ 2 ] ) . toEqual ( [ `ja: 'buz.inedexed.1' undefined` ] )
174
+ expect ( spyLog . mock . calls [ 3 ] ) . toEqual ( [ `ja: 'buz.inedexed.10' undefined` ] )
175
+ expect ( spyLog . mock . calls [ 4 ] ) . toEqual ( [ `ja: 'buz.inedexed.20' undefined` ] )
170
176
expect ( JSON . parse ( writeFiles [ 'ja.json' ] ) ) . toEqual ( {
171
177
foo : '' ,
172
- bar : { buz : '' }
178
+ bar : { buz : '' } ,
179
+ buz : {
180
+ inedexed : { '1' : '' , '10' : '' , '20' : '' }
181
+ }
173
182
} )
174
183
} )
175
184
You can’t perform that action at this time.
0 commit comments