LCOV - code coverage report
Current view: top level - src/renderer/extensions/vueNodes/widgets/utils - comboSpecDescriptor.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 14 14
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { ResultItemType } from '@comfyorg/api-client/resultItemTypeSchema'
       2              : import type { ComboInputSpec } from '@comfyorg/object-info-parser/schemas/nodeDefSchemaV2'
       3              : import type { AssetKind } from '@/types/widgetTypes'
       4              : 
       5              : export interface ComboSpecDescriptor {
       6              :   kind: AssetKind
       7              :   allowUpload: boolean
       8              :   folder: ResultItemType | undefined
       9              :   subfolder: string | undefined
      10              : }
      11              : 
      12         3930 : export function parseComboSpecDescriptor(
      13              :   spec: ComboInputSpec | undefined
      14              : ): ComboSpecDescriptor {
      15         3930 :   if (!spec) {
      16           72 :     return {
      17              :       kind: 'unknown',
      18              :       allowUpload: false,
      19              :       folder: undefined,
      20              :       subfolder: undefined
      21              :     }
      22              :   }
      23              : 
      24         3858 :   const {
      25              :     image_upload,
      26              :     animated_image_upload,
      27              :     video_upload,
      28              :     image_folder,
      29              :     audio_upload,
      30              :     mesh_upload,
      31              :     upload_subfolder
      32              :   } = spec
      33              : 
      34         3858 :   let kind: AssetKind = 'unknown'
      35         3925 :   if (video_upload) {
      36           17 :     kind = 'video'
      37         3841 :   } else if (image_upload || animated_image_upload) {
      38          149 :     kind = 'image'
      39         3692 :   } else if (audio_upload) {
      40           10 :     kind = 'audio'
      41         3682 :   } else if (mesh_upload) {
      42           21 :     kind = 'mesh'
      43              :   }
      44              : 
      45              :   const allowUpload =
      46              :     image_upload === true ||
      47              :     animated_image_upload === true ||
      48              :     video_upload === true ||
      49              :     audio_upload === true ||
      50              :     mesh_upload === true
      51              : 
      52         3930 :   return {
      53              :     kind,
      54              :     allowUpload,
      55              :     folder: mesh_upload ? 'input' : image_folder,
      56              :     subfolder: upload_subfolder
      57              :   }
      58              : }
        

Generated by: LCOV version 2.0-1