@@ -1128,6 +1128,103 @@ describe('DownloadCommand', () => {
11281128 expect ( apiClient . translationsApi . buildProject ) . toHaveBeenCalledWith ( 123 , { skipUntranslatedFiles : true } ) ;
11291129 } ) ;
11301130
1131+ test ( 'sends explicit false export options so project settings are overridden' , async ( ) => {
1132+ await Bun . write ( join ( tempDir , 'resources/en/messages.json' ) , '{}' ) ;
1133+ mockBuildAndDownload ( [ language ( 'fr' , 'fr-FR' ) ] ) ;
1134+ mockZipEntries ( [ { entryName : 'resources/fr-FR/messages.json' , content : 'translated' } ] ) ;
1135+
1136+ const downloadCommand = createCommandFor ( {
1137+ ...config ,
1138+ files : [
1139+ {
1140+ source : '/resources/en/*.json' ,
1141+ translation : '/resources/%locale%/%original_file_name%' ,
1142+ skip_untranslated_strings : false ,
1143+ skip_untranslated_files : false ,
1144+ export_only_approved : false ,
1145+ } ,
1146+ ] ,
1147+ } ) ;
1148+
1149+ await downloadCommand . translationsAction ( commandContext ) ;
1150+
1151+ expect ( apiClient . translationsApi . buildProject ) . toHaveBeenCalledWith ( 123 , {
1152+ skipUntranslatedStrings : false ,
1153+ skipUntranslatedFiles : false ,
1154+ exportApprovedOnly : false ,
1155+ } ) ;
1156+ } ) ;
1157+
1158+ test ( 'omits export options that are not set in the config' , async ( ) => {
1159+ await Bun . write ( join ( tempDir , 'resources/en/messages.json' ) , '{}' ) ;
1160+ mockBuildAndDownload ( [ language ( 'fr' , 'fr-FR' ) ] ) ;
1161+ mockZipEntries ( [ { entryName : 'resources/fr-FR/messages.json' , content : 'translated' } ] ) ;
1162+
1163+ const downloadCommand = createCommandFor ( {
1164+ ...config ,
1165+ files : [ { source : '/resources/en/*.json' , translation : '/resources/%locale%/%original_file_name%' } ] ,
1166+ } ) ;
1167+
1168+ await downloadCommand . translationsAction ( commandContext ) ;
1169+
1170+ expect ( apiClient . translationsApi . buildProject ) . toHaveBeenCalledWith ( 123 , { } ) ;
1171+ } ) ;
1172+
1173+ test ( 'keeps an explicit false and an unset option as separate builds' , async ( ) => {
1174+ await Bun . write ( join ( tempDir , 'resources/en/a.json' ) , '{}' ) ;
1175+ await Bun . write ( join ( tempDir , 'resources/en/b.json' ) , '{}' ) ;
1176+ mockBuildAndDownload ( [ language ( 'fr' , 'fr-FR' ) ] ) ;
1177+ mockZipEntries ( [
1178+ { entryName : 'resources/fr-FR/a.json' , content : 'a-fr' } ,
1179+ { entryName : 'resources/fr-FR/b.json' , content : 'b-fr' } ,
1180+ ] ) ;
1181+
1182+ commandContext = createCommandContext ( { ...globalOptions , ignoreMatch : true } ) ;
1183+
1184+ const downloadCommand = createCommandFor ( {
1185+ ...config ,
1186+ files : [
1187+ {
1188+ source : '/resources/en/a.json' ,
1189+ translation : '/resources/%locale%/%original_file_name%' ,
1190+ skip_untranslated_files : false ,
1191+ } ,
1192+ {
1193+ source : '/resources/en/b.json' ,
1194+ translation : '/resources/%locale%/%original_file_name%' ,
1195+ } ,
1196+ ] ,
1197+ } ) ;
1198+
1199+ await downloadCommand . translationsAction ( commandContext ) ;
1200+
1201+ expect ( apiClient . translationsApi . buildProject ) . toHaveBeenCalledTimes ( 2 ) ;
1202+ expect ( apiClient . translationsApi . buildProject ) . toHaveBeenCalledWith ( 123 , { skipUntranslatedFiles : false } ) ;
1203+ expect ( apiClient . translationsApi . buildProject ) . toHaveBeenCalledWith ( 123 , { } ) ;
1204+ } ) ;
1205+
1206+ test ( 'ignores export_only_approved: false on enterprise, which cannot force approvals off' , async ( ) => {
1207+ spyOn ( projectService , 'isEnterprise' ) . mockReturnValue ( true ) ;
1208+ await Bun . write ( join ( tempDir , 'resources/en/messages.json' ) , '{}' ) ;
1209+ mockBuildAndDownload ( [ language ( 'fr' , 'fr-FR' ) ] ) ;
1210+ mockZipEntries ( [ { entryName : 'resources/fr-FR/messages.json' , content : 'translated' } ] ) ;
1211+
1212+ const downloadCommand = createCommandFor ( {
1213+ ...config ,
1214+ files : [
1215+ {
1216+ source : '/resources/en/*.json' ,
1217+ translation : '/resources/%locale%/%original_file_name%' ,
1218+ export_only_approved : false ,
1219+ } ,
1220+ ] ,
1221+ } ) ;
1222+
1223+ await downloadCommand . translationsAction ( commandContext ) ;
1224+
1225+ expect ( apiClient . translationsApi . buildProject ) . toHaveBeenCalledWith ( 123 , { } ) ;
1226+ } ) ;
1227+
11311228 test ( 'maps export_only_approved to exportWithMinApprovalsCount on enterprise' , async ( ) => {
11321229 spyOn ( projectService , 'isEnterprise' ) . mockReturnValue ( true ) ;
11331230 await Bun . write ( join ( tempDir , 'resources/en/messages.json' ) , '{}' ) ;
0 commit comments