0.3.2: Save As filename prompt per print (Windows + macOS)

- promptForFilename setting (default true; env VERAE_PROMPT_FOR_FILENAME),
  'verae-print config --prompt-for-filename', last Save As folder in
  ~/.verae/state.json
- Windows helper: common file dialog (PDF filter, overwrite prompt, topmost
  owner) before stamping; macOS printer path: choose file name (NSSavePanel)
  via 'stamp -prompt-name -title'; cancel discards the job (no stamp/credit)
- job.Options.OutPath: original saved at the chosen path, certificate and
  .verae.json next to it with the chosen base name (never overwritten)
- held jobs keep the chosen path (pendingMeta.OutPath)
- installer: 'Ask for a file name for each print' checkbox; removed the
  'Open the user guide' finish-page checkbox; mac-key-setup asks too
- auth test no longer touches the real macOS keychain (VERAE_SKIP_KEYCHAIN)
- version 0.3.2
This commit is contained in:
Grok Bot (for George) 2026-10-03 20:00:56 -04:00
commit 13ebc351f5

View file

@ -146,3 +146,36 @@ func TestRunNeverOverwritesSameName(t *testing.T) {
t.Fatal(p, err)
}
}
func TestRunWithChosenPath(t *testing.T) {
dir := t.TempDir()
src := filepath.Join(dir, "spool.pdf")
_ = os.WriteFile(src, []byte("%PDF-1.4 new"), 0o600)
pick := filepath.Join(dir, "My Contract v2.pdf")
_ = os.WriteFile(pick, []byte("old"), 0o600) // user confirmed "Replace"
client := &veraeapi.Client{Channel: auth.ChannelZapier, ZapierBase: "https://zap.test", XVeraeToken: "xVerae-x",
HTTPDo: func(req *http.Request) (*http.Response, error) {
return &http.Response{StatusCode: 200, Body: io.NopCloser(strings.NewReader(`{"receipt_id":"bafyR1"}`)), Header: make(http.Header)}, nil
}}
for i := 0; i < 2; i++ {
res, err := Run(Options{SourcePDF: src, OutPath: pick, Channel: auth.ChannelZapier, Client: client})
if err != nil {
t.Fatal(err)
}
if res.OriginalPDF != pick {
t.Fatal(res.OriginalPDF)
}
wantCert := "My Contract v2-verae-timestamp-bafyR1.pdf"
wantJSON := "My Contract v2.verae.json"
if i == 1 {
wantCert = "My Contract v2-verae-timestamp-bafyR1-2.pdf"
wantJSON = "My Contract v2-2.verae.json"
}
if filepath.Base(res.CertificatePDF) != wantCert || filepath.Base(res.ReceiptJSON) != wantJSON {
t.Fatalf("run %d: %s %s", i, filepath.Base(res.CertificatePDF), filepath.Base(res.ReceiptJSON))
}
}
if b, _ := os.ReadFile(pick); string(b) != "%PDF-1.4 new" {
t.Fatal("original not written to chosen path")
}
}