Skip to content

Test the uninstall command (removal + --purge + --dry-run) #33

Description

@ropdias

Follow-up to #5. Builds on the vitest infra and the temp-dir pattern established in src/core/settings.spec.ts.

Scope

src/commands/uninstall.ts. Drive cmdUninstall against a temp dir.

Cases to cover

  • Removes only our block: with a tokenline statusLine present (detected via isTokenlineCommand), it deletes just that key, backs up first (settings.json.bak), and leaves unrelated keys intact.
  • Foreign statusLine left untouched: a non-tokenline statusLine is not removed.
  • No usable settings: missing file or invalid JSON → warns, changes nothing.
  • --purge also deletes the installed tokenline.sh; without --purge the script stays.
  • --dry-run writes nothing and deletes nothing (both the settings edit and the purge).
  • Exit codes behave as expected.

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)testingTests 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