Test quak login and backup-metadata --exif #125

Merged
clawbot merged 1 commits from issue-110-cli-tests into next2 2026-09-23 09:27:41 +02:00
Collaborator

Closes #110.

loginCommand now gets its login function and its prompts from CliContext (login, prompt, promptSecret). bin/quak.ts passes Client.login and the terminal prompts, so the command behaves as before. The terminal prompt import moved from src/cli-commands.ts to bin/quak.ts with them.

New tests in test/cli/commands.test.ts:

  • login with QUAK_EMAIL and QUAK_PASSWORD set shows no prompt and prints the usual lines
  • the session saved by login has mode 0600 in a 0700 directory
  • an account that needs TOTP gets the TOTP code: prompt
  • a failed login exits 1, prints Login failed: ..., and writes no session file
  • --exif and --all each turn on EXIF extraction, and it is off without either flag. The tests check this by the command's Extracting EXIF... progress line.

The shared test context gets login and prompt functions that throw, so any other command that tried to log in or prompt would fail its test.

Also rewrapped the header comment of src/cli-commands.ts, which broke mid-sentence.

Judgement call: the environment variables are set in the tests with vi.stubEnv, not passed through the context. The issue only asked for the login function and the prompts to be passed in.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/quak/issues/110. `loginCommand` now gets its login function and its prompts from `CliContext` (`login`, `prompt`, `promptSecret`). `bin/quak.ts` passes `Client.login` and the terminal prompts, so the command behaves as before. The terminal prompt import moved from `src/cli-commands.ts` to `bin/quak.ts` with them. New tests in `test/cli/commands.test.ts`: - login with `QUAK_EMAIL` and `QUAK_PASSWORD` set shows no prompt and prints the usual lines - the session saved by login has mode `0600` in a `0700` directory - an account that needs TOTP gets the `TOTP code: ` prompt - a failed login exits 1, prints `Login failed: ...`, and writes no session file - `--exif` and `--all` each turn on EXIF extraction, and it is off without either flag. The tests check this by the command's `Extracting EXIF...` progress line. The shared test context gets `login` and prompt functions that throw, so any other command that tried to log in or prompt would fail its test. Also rewrapped the header comment of `src/cli-commands.ts`, which broke mid-sentence. Judgement call: the environment variables are set in the tests with `vi.stubEnv`, not passed through the context. The issue only asked for the login function and the prompts to be passed in. Model: opus-5-5
clawbot self-assigned this 2026-09-23 08:58:25 +02:00
clawbot added 1 commit 2026-09-23 08:58:25 +02:00
loginCommand now takes its login function and prompts from CliContext;
bin/quak.ts passes Client.login and the terminal prompts, so behaviour is
unchanged. Tests cover a login from QUAK_EMAIL/QUAK_PASSWORD with no
prompt, the TOTP prompt, a failed login, and the saved session's modes,
and show that --exif and --all each turn on EXIF extraction. Also rewraps
the header comment of src/cli-commands.ts.

Model: opus-5-5
clawbot added the needs-review label 2026-09-23 08:58:31 +02:00
Author
Collaborator

PASS on f440caa rebased onto next2 ae76eb3.

Model: opus-5-5

PASS on `f440caa` rebased onto `next2` `ae76eb3`. Model: opus-5-5
clawbot merged commit 7740ebfd4d into next2 2026-09-23 09:27:41 +02:00
clawbot deleted branch issue-110-cli-tests 2026-09-23 09:27:41 +02:00
Sign in to join this conversation.