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> =>
124124
125125 const unflattedLocaleMessages = { } as LocaleMessages
126126 Object . keys ( flattedLocaleMessages ) . forEach ( locale => {
127- unflattedLocaleMessages [ locale ] = unflatten ( flattedLocaleMessages [ locale ] )
127+ unflattedLocaleMessages [ locale ] = unflatten ( flattedLocaleMessages [ locale ] , { object : true } )
128128 } )
129129
130130 await tweakLocaleMessages ( unflattedLocaleMessages , args )
Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ test('--define option', async () => {
143143 mockUtils . getLocaleMessages . mockImplementation ( ( ...args ) => ( {
144144 en : {
145145 foo : 'foo' ,
146- bar : { buz : 'buz' }
146+ bar : { buz : 'buz' } ,
147+ buz : {
148+ inedexed : { '1' : 'low' , '10' : 'middle' , '20' : 'high' }
149+ }
147150 } ,
148151 ja : { }
149152 } ) )
@@ -164,12 +167,18 @@ test('--define option', async () => {
164167 await flash ( )
165168
166169 // verify
167- expect ( spyLog ) . toHaveBeenCalledTimes ( 3 )
170+ expect ( spyLog ) . toHaveBeenCalledTimes ( 6 )
168171 expect ( spyLog . mock . calls [ 0 ] ) . toEqual ( [ `ja: 'foo' undefined` ] )
169172 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` ] )
170176 expect ( JSON . parse ( writeFiles [ 'ja.json' ] ) ) . toEqual ( {
171177 foo : '' ,
172- bar : { buz : '' }
178+ bar : { buz : '' } ,
179+ buz : {
180+ inedexed : { '1' : '' , '10' : '' , '20' : '' }
181+ }
173182 } )
174183} )
175184
You can’t perform that action at this time.
0 commit comments