LCOV - code coverage report
Current view: top level - src/platform/workflowErrors/missingModel - missingModelDownloadProgress.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 50.0 % 6 3
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { MissingModelDownloadState } from '@/platform/workflowErrors/missingModel/missingModelDownloadStore'
       2              : import { formatSize } from '@/utils/formatUtil'
       3              : 
       4              : /** Received and total bytes of a running download, as far as the host reported them. */
       5           34 : export function formatDownloadedBytes(
       6              :   state: MissingModelDownloadState
       7              : ): string | undefined {
       8           34 :   if (state.status !== 'downloading') return undefined
       9            0 :   const { receivedBytes, totalBytes } = state
      10           34 :   if (
      11              :     receivedBytes !== null &&
      12              :     totalBytes !== null &&
      13              :     totalBytes > 0 &&
      14              :     receivedBytes <= totalBytes
      15              :   ) {
      16            0 :     return `${formatSize(receivedBytes)} / ${formatSize(totalBytes)}`
      17              :   }
      18            0 :   if (receivedBytes !== null) return formatSize(receivedBytes)
      19              :   return undefined
      20              : }
        

Generated by: LCOV version 2.0-1