LCOV - code coverage report
Current view: top level - src/platform/billing/components - subscriptionPanelWorkspace.logic.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 21.4 % 14 3
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { TierKey } from '@/platform/billing/subscription/constants/tierPricing'
       2              : import { toTierKey } from '@/platform/billing/subscription/constants/tierPricing'
       3              : import type { SubscriptionTier } from '@comfyorg/billing-core'
       4              : 
       5           10 : export function resolveSubscriptionTierKey(
       6              :   tier: SubscriptionTier | null | undefined
       7              : ): TierKey {
       8           10 :   if (!tier) return 'free'
       9           10 :   return toTierKey(tier) ?? 'standard'
      10              : }
      11              : 
      12            0 : export function formatSubscriptionDate(
      13              :   isoDate: string | null | undefined,
      14              :   locale: string
      15              : ): string {
      16            0 :   if (!isoDate) return ''
      17            0 :   const calendarDate = /^(\d{4})-(\d{2})-(\d{2})T/.exec(isoDate)
      18            0 :   if (!calendarDate) return ''
      19              : 
      20            0 :   const [, year, month, day] = calendarDate
      21            0 :   const calendarCheck = new Date(
      22              :     Date.UTC(Number(year), Number(month) - 1, Number(day))
      23              :   )
      24            0 :   if (
      25              :     calendarCheck.getUTCFullYear() !== Number(year) ||
      26              :     calendarCheck.getUTCMonth() + 1 !== Number(month) ||
      27              :     calendarCheck.getUTCDate() !== Number(day)
      28              :   )
      29            0 :     return ''
      30              : 
      31            0 :   const date = new Date(isoDate)
      32            0 :   if (Number.isNaN(date.getTime())) return ''
      33              : 
      34            0 :   return date.toLocaleDateString(locale, {
      35              :     month: 'short',
      36              :     day: 'numeric',
      37              :     year: 'numeric'
      38              :   })
      39              : }
        

Generated by: LCOV version 2.0-1