LCOV - code coverage report
Current view: top level - src/platform/assets/composables - useAssetZipExport.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 36.4 % 11 4
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { CreateAssetExportData } from '@comfyorg/ingest-types'
       2              : import { useI18n } from 'vue-i18n'
       3              : 
       4              : import { useToast } from '@/components/ui/toast/toastStore'
       5              : import { assetService } from '@/platform/assets/services/assetService'
       6              : import { reportError } from '@comfyorg/telemetry/reportError'
       7              : import { useAssetExportStore } from '@/stores/assetExportStore'
       8              : 
       9         5269 : export function useAssetZipExport() {
      10         5269 :   const { t } = useI18n()
      11         5269 :   const toast = useToast()
      12              : 
      13            0 :   async function startZipExport(
      14              :     request: CreateAssetExportData['body'],
      15              :     fileCount: number
      16              :   ): Promise<void> {
      17            0 :     try {
      18            0 :       const { task_id } = await assetService.createAssetExport(request)
      19            0 :       useAssetExportStore().trackExport(task_id)
      20            0 :       toast.info(t('exportToast.exportStarted'), {
      21              :         description: t(
      22              :           'mediaAsset.selection.exportStarted',
      23              :           { count: fileCount },
      24              :           fileCount
      25              :         ),
      26              :         duration: 3000
      27              :       })
      28              :     } catch (error) {
      29            0 :       reportError(error, {
      30              :         errorType: 'error_exporting_assets',
      31              :         surface: 'assets',
      32              :         context: { count: fileCount }
      33              :       })
      34            0 :       toast.error(t('g.error'), {
      35              :         description: t('exportToast.exportFailedSingle')
      36              :       })
      37              :     }
      38              :   }
      39              : 
      40         5269 :   return { startZipExport }
      41              : }
        

Generated by: LCOV version 2.0-1