Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1003 B
Raw Blame
import { render, waitFor } from '@testing-library/react'
import { REGISTRATION_SUCCESS_STORAGE_KEY } from '../../amplitude/registration-session-state'
import {
  coordinateRegistrationConsent,
  rememberRegistrationSuccess,
} from '../../amplitude/registration-tracking'
import { AnalyticsDisabled } from '../analytics-disabled'
import { getAnalyticsConsent, setAnalyticsConsent } from '../consent-store'

describe('AnalyticsDisabled', () => {
  beforeEach(() => {
    window.sessionStorage.clear()
    coordinateRegistrationConsent('denied')
    setAnalyticsConsent('granted')
  })

  it('terminally discards a pending registration marker', async () => {
    rememberRegistrationSuccess({ method: 'email' })
    expect(window.sessionStorage.getItem(REGISTRATION_SUCCESS_STORAGE_KEY)).not.toBeNull()

    render(<AnalyticsDisabled />)

    await waitFor(() => expect(getAnalyticsConsent()).toBe('disabled'))
    expect(window.sessionStorage.getItem(REGISTRATION_SUCCESS_STORAGE_KEY)).toBeNull()
  })
})