LCOV - code coverage report
Current view: top level - packages/account-core/src/core/billing/billingTab - creditBanner.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 77.8 % 9 7
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { AutoTopUpBannerKind } from './autoTopUpBanner'
       2              : 
       3              : export type LocalCreditBannerKind =
       4              :   | 'outOfCredits'
       5              :   | AutoTopUpBannerKind
       6              :   | 'lowCredits'
       7              : 
       8              : export interface LocalCreditBannerInput {
       9              :   unifiedBillingSettingsEnabled: boolean
      10              :   isCloud: boolean
      11              :   isActive: boolean
      12              :   hasFunds: boolean | null
      13              :   lowBalance: boolean | undefined
      14              :   outOfCreditsDismissed: boolean
      15              :   lowCreditsDismissed: boolean
      16              :   autoTopUp: AutoTopUpBannerKind | null
      17              : }
      18              : 
      19              : /** The credit banner: a served auto top-up banner first, then out of credits, then low credits, each until dismissed. */
      20            5 : export function deriveLocalCreditBanner(
      21              :   input: LocalCreditBannerInput
      22              : ): LocalCreditBannerKind | null {
      23            5 :   if (!input.unifiedBillingSettingsEnabled) return null
      24            5 :   if (input.autoTopUp) return input.autoTopUp
      25            5 :   if (input.isCloud && !input.isActive) return null
      26            5 :   if (input.hasFunds === false && !input.outOfCreditsDismissed) {
      27            0 :     return 'outOfCredits'
      28              :   }
      29            5 :   if (input.lowBalance === true && !input.lowCreditsDismissed) {
      30            0 :     return 'lowCredits'
      31              :   }
      32            5 :   return null
      33              : }
        

Generated by: LCOV version 2.0-1