LCOV - code coverage report
Current view: top level - src/utils - queueUtil.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 90.0 % 10 9
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { TaskItemImpl } from '@/stores/queueStore'
       2              : import type { JobState } from '@/types/queue'
       3              : 
       4              : /**
       5              :  * Checks if a job state represents an active (in-progress) job.
       6              :  */
       7           84 : export function isActiveJobState(state: JobState): boolean {
       8           84 :   return (
       9              :     state === 'pending' || state === 'initialization' || state === 'running'
      10              :   )
      11              : }
      12              : 
      13              : /**
      14              :  * Map a task to a UI job state, including initialization override.
      15              :  *
      16              :  * @param task Task item from the queue store
      17              :  * @param isInitializing True if the prompt is currently initializing
      18              :  * @returns JobState for UI
      19              :  */
      20         2355 : export const jobStateFromTask = (
      21              :   task: TaskItemImpl,
      22              :   isInitializing: boolean
      23              : ): JobState => {
      24         2145 :   if (isInitializing) return 'initialization'
      25              :   const status = task.displayStatus
      26         2145 :   switch (status) {
      27              :     case 'Running':
      28           57 :       return 'running'
      29              :     case 'Pending':
      30            8 :       return 'pending'
      31              :     case 'Completed':
      32         1609 :       return 'completed'
      33              :     case 'Failed':
      34              :     case 'Cancelled':
      35          471 :       return 'failed'
      36              :   }
      37            0 :   return 'failed'
      38              : }
        

Generated by: LCOV version 2.0-1