mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 10:12:11 +00:00
[backport rh-test] add telemetry provider for cloud distribution (#6155)
## Summary This PR manually backports the telemetry provider implementation to the rh-test branch after the automated backport failed due to merge conflicts. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6155-Manual-backport-add-telemetry-provider-for-cloud-distribution-2926d73d3650812e94e2fe0bd5e9bc59) by [Unito](https://www.unito.io) --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,10 @@ vi.mock('@/composables/auth/useCurrentUser', () => ({
|
||||
}))
|
||||
}))
|
||||
|
||||
vi.mock('@/platform/telemetry', () => ({
|
||||
useTelemetry: vi.fn(() => null)
|
||||
}))
|
||||
|
||||
vi.mock('@/composables/auth/useFirebaseAuthActions', () => ({
|
||||
useFirebaseAuthActions: vi.fn(() => ({
|
||||
reportError: mockReportError,
|
||||
|
||||
30
tests-ui/tests/platform/telemetry/useTelemetry.test.ts
Normal file
30
tests-ui/tests/platform/telemetry/useTelemetry.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
vi.mock('@/platform/distribution/types', () => ({
|
||||
isCloud: false
|
||||
}))
|
||||
|
||||
describe('useTelemetry', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('should return null when not in cloud distribution', async () => {
|
||||
const { useTelemetry } = await import('@/platform/telemetry')
|
||||
const provider = useTelemetry()
|
||||
|
||||
// Should return null for OSS builds
|
||||
expect(provider).toBeNull()
|
||||
})
|
||||
|
||||
it('should return null consistently for OSS builds', async () => {
|
||||
const { useTelemetry } = await import('@/platform/telemetry')
|
||||
|
||||
const provider1 = useTelemetry()
|
||||
const provider2 = useTelemetry()
|
||||
|
||||
// Both should be null for OSS builds
|
||||
expect(provider1).toBeNull()
|
||||
expect(provider2).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user