LCOV - code coverage report
Current view: top level - src/platform/billing - processingTopupPayment.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 42.9 % 7 3
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { HostedTopupCheckout } from '@comfyorg/ingest-types'
       2              : 
       3              : export interface ProcessingTopupPayment {
       4              :   paymentAmountCents: number | null
       5              : }
       6              : 
       7            0 : function servedPaymentAmount(cents: number | null): number | null {
       8            0 :   return cents !== null && Number.isSafeInteger(cents) && cents >= 0
       9              :     ? cents
      10              :     : null
      11              : }
      12              : 
      13            7 : export function processingTopupPayment(
      14              :   checkouts: readonly HostedTopupCheckout[]
      15              : ): ProcessingTopupPayment | null {
      16            7 :   const processing = checkouts.filter(
      17              :     (checkout) => checkout.state === 'payment_processing'
      18              :   )
      19            7 :   if (processing.length === 0) return null
      20              : 
      21            0 :   if (processing.length !== 1) return { paymentAmountCents: null }
      22              : 
      23            0 :   return {
      24              :     paymentAmountCents: servedPaymentAmount(processing[0].payment_amount_cents)
      25              :   }
      26              : }
        

Generated by: LCOV version 2.0-1