Skip to content

Phase 1: Foundation Tests - Utility Functions & Constants #171

Closed

Description

@babblebey

Part of: #170

📋 Phase 1: Foundation Tests (High Priority)

Scope

This phase focuses on testing pure functions with no dependencies - the foundation of our testing strategy.

1. Utility Functions (src/lib/utils/)

Why start here: Pure functions, no dependencies, easy to test and validate core logic.

utils/index.js - Core Utilities

  • resolveCookieExpiryDate() - Date calculations
  • getRepoParts() - String parsing for GitHub repos
  • normalizeAsUrl() - URL slug generation
  • isObjectEmpty() - Object validation
  • resolveEditorActionFromPathname() - URL parsing
  • capitalizeText() - Text formatting
  • generateBranchName() - Git branch naming
  • buildStatsUrl() - URL construction
  • buildWordPathname() - Path generation
  • buildWordSlug() - Slug creation

utils/crypto.js - Encryption/Decryption

  • encrypt() - Data encryption
  • decrypt() - Data decryption
  • Encryption/decryption round-trip tests
  • Error handling for invalid inputs

2. Constants & Configuration

Why important: Validates core configuration values used throughout app.

constants.js

  • Validate all constants are properly defined
  • GitHub repository details structure
  • Labels configuration
  • Environment-specific values

🎯 Success Criteria

  • 90%+ coverage for utility functions
  • All utility functions have comprehensive test cases
  • Constants validation tests in place
  • No console errors during test runs

📅 Timeline

Week 1 of testing implementation

🛠️ Setup Required

  • Install testing dependencies (Vitest, etc.)
  • Create basic test structure
  • Set up test configuration

Activity

  1. self-assigned this
    on Sep 5, 2025
  2. added a commit that references this issue on Sep 5, 2025
    bc88b1c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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