Skip to content

Refactor Test Helpers to Reduce Duplication #16

@mwoods79

Description

@mwoods79

Priority

Low - Technical debt

Description

Multiple test files have duplicate setup code. This makes tests harder to maintain and violates the DRY principle. We should extract common patterns into shared modules.

Current State

  • Test setup code is duplicated across multiple test files
  • Common patterns like creating verified users, groups, and huddlz are repeated
  • Makes it harder to update test logic consistently

Acceptance Criteria

  • Create shared test support modules in test/support/
  • Extract common generators (verified users, groups with members, etc.)
  • Extract common assertion helpers
  • Update existing tests to use shared helpers
  • Document test patterns and helpers
  • Ensure all tests still pass after refactoring

Technical Notes

  • Look for patterns in test/huddlz/communities/*_test.exs files
  • Consider creating modules like TestHelpers.Users, TestHelpers.Groups
  • Use ExUnit.CaseTemplate for common setup
  • Maintain backward compatibility during refactoring

Benefits

  • Easier to maintain tests
  • Faster to write new tests
  • Consistent test data generation
  • Single source of truth for test helpers

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions