Skip to content

test: add E2E coverage for login/logout, snapshot publish/import URL, dotfiles, and macOS defaults#32

Merged
fullstackjam merged 3 commits intomainfrom
claude/add-e2e-tests-CWtU9
Apr 19, 2026
Merged

test: add E2E coverage for login/logout, snapshot publish/import URL, dotfiles, and macOS defaults#32
fullstackjam merged 3 commits intomainfrom
claude/add-e2e-tests-CWtU9

Conversation

@fullstackjam
Copy link
Copy Markdown
Collaborator

Fills five uncovered release risks identified in the pre-ship audit:

login / logout (test/e2e/auth_e2e_test.go)

  • Runs compiled binary against httptest.NewServer mock (OPENBOOT_API_URL
    override); verifies auth.json creation, "already logged in" path,
    "expired code" error message, and graceful logout in both states.

snapshot --publish (test/e2e/snapshot_api_e2e_test.go)

  • PUT (update existing config via stored sync source), explicit --slug PUT,
    and 409 conflict — all exercised against a local mock API server.

snapshot --import URL (test/e2e/snapshot_api_e2e_test.go +
internal/cli/snapshot_http_test.go)

  • Binary-level http:// rejection and HTTPS download error.
  • Unit tests for downloadSnapshotBytes with a real TLS server (ts.Client),
    10 MiB size-cap invariant, and full postSnapshotToAPI coverage (POST/PUT
    methods, auth header, 409 conflict parsing, slug fallback).

dotfiles clone + stow (test/e2e/dotfiles_e2e_test.go)

  • Verifies ~/.dotfiles/.git exists AND at least one symlink in HOME points
    into ~/.dotfiles (link/stow step was previously unchecked).
  • Second-run idempotency and --dotfiles link-only mode.

macOS defaults write (test/e2e/macos_defaults_e2e_test.go)

  • Runs --macos configure in isolation; asserts defaults from all 6 categories
    (System, Finder, Dock, Screenshots, Mission Control, Security).
  • ~/Screenshots dir creation and dry-run no-write guard.

https://claude.ai/code/session_01DYJQz9cEsd2Fft1wrwbykb

… dotfiles, and macOS defaults

Fills five uncovered release risks identified in the pre-ship audit:

**login / logout (test/e2e/auth_e2e_test.go)**
- Runs compiled binary against httptest.NewServer mock (OPENBOOT_API_URL
  override); verifies auth.json creation, "already logged in" path,
  "expired code" error message, and graceful logout in both states.

**snapshot --publish (test/e2e/snapshot_api_e2e_test.go)**
- PUT (update existing config via stored sync source), explicit --slug PUT,
  and 409 conflict — all exercised against a local mock API server.

**snapshot --import URL (test/e2e/snapshot_api_e2e_test.go +
internal/cli/snapshot_http_test.go)**
- Binary-level http:// rejection and HTTPS download error.
- Unit tests for downloadSnapshotBytes with a real TLS server (ts.Client),
  10 MiB size-cap invariant, and full postSnapshotToAPI coverage (POST/PUT
  methods, auth header, 409 conflict parsing, slug fallback).

**dotfiles clone + stow (test/e2e/dotfiles_e2e_test.go)**
- Verifies ~/.dotfiles/.git exists AND at least one symlink in HOME points
  into ~/.dotfiles (link/stow step was previously unchecked).
- Second-run idempotency and --dotfiles link-only mode.

**macOS defaults write (test/e2e/macos_defaults_e2e_test.go)**
- Runs --macos configure in isolation; asserts defaults from all 6 categories
  (System, Finder, Dock, Screenshots, Mission Control, Security).
- ~/Screenshots dir creation and dry-run no-write guard.

https://claude.ai/code/session_01DYJQz9cEsd2Fft1wrwbykb
@github-actions
Copy link
Copy Markdown

👋 Thanks for opening this pull request!

Before merging:

  • Code follows existing patterns in the codebase
  • go build ./... and go vet ./... pass
  • Commit message is clear and descriptive

@fullstackjam will review this soon. Thanks for contributing! 🚀

@github-actions github-actions bot added the tests Tests only label Apr 19, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

claude added 2 commits April 19, 2026 09:31
- auth_e2e_test.go: replace OR-chain assertions with exact strings from
  source (e.g. "Already logged in as existinguser"), remove unused strings import
- dotfiles_e2e_test.go: capture symlink count before install and compare
  before/after so the link-step check isn't trivially true on dirty runners;
  add countDotfileSymlinksCmd constant
- macos_defaults_e2e_test.go: force AppleShowScrollBars to "WhenScrolling"
  before dry-run so the test fails if dry-run accidentally writes "Always"

https://claude.ai/code/session_01DYJQz9cEsd2Fft1wrwbykb
…s e2e tests

- Apply three-group import order (stdlib / third-party / local) to all
  test/e2e/*.go files per .golangci.yml local-prefixes setting
- Remove unused vmRunOpenboot and vmIsInstalled from vm_helpers_test.go
- Fix gofmt alignment issue in vm_user_journey_test.go (line 65 map literal)
- Apply same import grouping fix to internal/cli/snapshot_http_test.go

https://claude.ai/code/session_01DYJQz9cEsd2Fft1wrwbykb
@fullstackjam fullstackjam merged commit fddaa60 into main Apr 19, 2026
8 checks passed
@fullstackjam fullstackjam deleted the claude/add-e2e-tests-CWtU9 branch April 19, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants