Skip to content

test(analytics): comprehensive tests for analytics module #3298

@PierreBrisorgueil

Description

@PierreBrisorgueil

Context

Phase 4 PostHog — depends on all analytics issues.

What

  • Unit tests: mock posthog-node, verify all service methods
  • Integration tests: middleware captures requests correctly, identify/groupIdentify triggered on auth/org flows
  • E2E tests: full request flow with analytics middleware active
  • All tests use mocked posthog-node (no external dependency)

Acceptance criteria

  • Unit tests for analytics.service (track, identify, groupIdentify, shutdown)
  • Unit tests for featureFlags.service (isEnabled, getVariant, local eval, fallback)
  • Integration tests for auto-capture middleware
  • Integration tests for identify on signup/login
  • Integration tests for groupIdentify on org create/update/plan change
  • Coverage thresholds maintained

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions