LCOV - code coverage report
Current view: top level - src/platform/customNodes/manager/composables/nodePack - usePackUpdateStatus.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 10 10
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { MaybeRefOrGetter } from 'vue'
       2              : import { computed, toValue } from 'vue'
       3              : 
       4              : import type { components } from '@/types/comfyRegistryTypes'
       5              : import { useComfyManagerStore } from '@/platform/customNodes/manager/stores/comfyManagerStore'
       6              : import { getPackUpdateStatus } from '@/platform/customNodes/manager/composables/nodePack/packUpdateStatus'
       7              : 
       8         2355 : export const usePackUpdateStatus = (
       9              :   nodePackSource: MaybeRefOrGetter<components['schemas']['Node']>
      10              : ) => {
      11          194 :   const managerStore = useComfyManagerStore()
      12              : 
      13              :   // Use toValue to unwrap the source reactively inside computeds
      14          194 :   const nodePack = computed(() => toValue(nodePackSource))
      15              : 
      16          194 :   const status = computed(() =>
      17              :     getPackUpdateStatus(nodePack.value, managerStore)
      18              :   )
      19              : 
      20          194 :   const isInstalled = computed(() => status.value.isInstalled)
      21          194 :   const isEnabled = computed(() =>
      22              :     managerStore.isPackEnabled(nodePack.value.id)
      23              :   )
      24          194 :   const installedVersion = computed(() => status.value.installedVersion)
      25          194 :   const latestVersion = computed(() => status.value.latestVersion)
      26          194 :   const isNightlyPack = computed(() => status.value.isNightly)
      27              :   const isUpdateAvailable = computed(() => status.value.isUpdateAvailable)
      28              : 
      29              :   /**
      30              :    * Nightly packs can always "try update" since we cannot compare git hashes
      31              :    * to determine if an update is actually available. This allows users to
      32              :    * pull the latest changes from the repository.
      33              :    */
      34              :   const canTryNightlyUpdate = computed(
      35              :     () => isInstalled.value && isEnabled.value && isNightlyPack.value
      36              :   )
      37              : 
      38          194 :   return {
      39              :     isUpdateAvailable,
      40              :     isNightlyPack,
      41              :     canTryNightlyUpdate,
      42              :     installedVersion,
      43              :     latestVersion
      44              :   }
      45              : }
        

Generated by: LCOV version 2.0-1