Skip to content

Add unit tests for internal packages #12

@mart337i

Description

@mart337i

Problem

There are no Go unit tests (*_test.go files) in the codebase. The Makefile has a test target but there are no test files to run. The integration test script (test_all_commands.sh) covers the happy path well, but edge cases in pure functions are untested.

Packages That Would Benefit Most

These packages contain pure functions with no external dependencies -- ideal for unit testing:

internal/module

  • Hash() - SHA256 module hashing (test with known directory contents)
  • FindModules() - module discovery (test with temp directories)
  • ExpandPatterns() - glob expansion against module list
  • shouldExclude() - path exclusion logic (many edge cases)

internal/deps

  • ParsePipPackages() - comma-separated and requirements.txt parsing
  • ParseManifestPythonDeps() - Python manifest parsing (tricky string manipulation)

internal/config

  • CalculatePorts() - deterministic port calculation
  • FindAvailablePorts() - port conflict resolution

internal/git

  • VersionFromBranch() - branch name to version extraction

internal/scaffold

  • toPascal() - underscore to PascalCase conversion
  • isVersion18OrHigher() - version comparison
  • formatDepends() - dependency formatting

Why This Matters

ParseManifestPythonDeps does custom Python parsing via string manipulation. shouldExclude has complex path matching with parent directory checks. These are the kinds of functions where edge cases hide.

Priority: Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions