Skip to content

Unit-test pure helpers: paths, settings helpers, CLI arg parser #35

Description

@ropdias

Follow-up to #5. Small, pure unit tests — the closest match to the seed spec's style and a good first contribution. No temp dir needed for most of these (pure functions).

Scope & cases

src/core/paths.ts

  • statusLineCommand(path): leaves a space-free path unquoted (bash /p/tokenline.sh); quotes a path containing a space (bash "/My Drive/tokenline.sh").
  • claudeDir / scriptTarget / settingsTarget: --global vs project, and --dir override resolution.

src/core/settings.ts (remaining helpers)

  • isTokenlineCommand(cmd): matches .../tokenline.sh commands; false for undefined, empty, or a foreign command.
  • backup(file): copies filefile.bak (temp-dir test, reuse the seed spec's pattern).

src/cli.tsparseArgs

  • Parses --global / --dry-run / --force / --purge / --dir <path> and the -h/-v aliases.
  • Collects unknown -flags into unknown and positionals into _.
  • (May need parseArgs exported for direct testing — small refactor.)

Acceptance

  • pnpm test stays green locally and in CI.
  • The cases above are covered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:installerinstall.sh + npm CLI (src/cli.ts), settings.json patchingeffort:SOne file + check (~1h)good first issueGood for newcomerstestingTests and test infrastructure

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions