LCOV - code coverage report
Current view: top level - src/platform/onboarding - onboardingReset.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 0.0 % 14 0
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { isCloud } from '@/platform/distribution/types'
       2              : import { useSettingStore } from '@/platform/settings/settingStore'
       3              : import { api } from '@/scripts/api'
       4              : import { useAuthStore } from '@/stores/authStore'
       5              : 
       6              : import {
       7              :   clearOnboardingReplay,
       8              :   requestOnboardingReplay
       9              : } from './onboardingReplay'
      10              : import { TOUR_SEEN_SETTING } from './onboardingTours'
      11              : 
      12              : export type OnboardingResetResult =
      13              :   | { status: 'ready' }
      14              :   | { status: 'failed'; cause: unknown }
      15              : 
      16            0 : export async function resetOnboardingState(): Promise<OnboardingResetResult> {
      17            0 :   const ownerId = useAuthStore().userId
      18              :   if (isCloud && ownerId === undefined) {
      19              :     return {
      20              :       status: 'failed',
      21              :       cause:
      22              :         'No signed-in account, so the onboarding replay cannot be requested'
      23              :     }
      24              :   }
      25            0 :   if (!requestOnboardingReplay(ownerId)) {
      26            0 :     return {
      27              :       status: 'failed',
      28              :       cause:
      29              :         'Session storage is unavailable, so the onboarding replay cannot be requested'
      30              :     }
      31              :   }
      32              : 
      33            0 :   let response: Response
      34            0 :   try {
      35            0 :     response = await api.storeSetting(TOUR_SEEN_SETTING, [])
      36              :   } catch (cause) {
      37            0 :     clearOnboardingReplay(ownerId)
      38            0 :     return { status: 'failed', cause }
      39              :   }
      40              : 
      41            0 :   if (!response.ok) {
      42            0 :     clearOnboardingReplay(ownerId)
      43            0 :     return {
      44              :       status: 'failed',
      45              :       cause:
      46              :         `Failed to clear seen onboarding tours: ${response.status} ${response.statusText}`.trim()
      47              :     }
      48              :   }
      49              : 
      50            0 :   useSettingStore().settingValues[TOUR_SEEN_SETTING] = []
      51            0 :   return { status: 'ready' }
      52              : }
        

Generated by: LCOV version 2.0-1