Files
sift/cmd/sift/fetchcmd_test.go
T
kyle 2db001e0d7 p2: 120s write timeout and flags after the URL
WriteTimeout 30s was cutting digest mid-flight (queue+fetch+digest)
and tailscale then 502'd. 120s write, 90s handler deadline.
sift fetch URL --question now parses; extra positionals error.
2026-09-23 00:28:59 -07:00

31 lines
885 B
Go

package main
import "testing"
func TestParseFetchFlagsAfterURL(t *testing.T) {
url, mode, _, q, noCtx, rec, _, err := parseFetchArgs([]string{"https://example.com/x", "--question", "what", "--mode", "digest", "--recover"})
if err != nil {
t.Fatal(err)
}
if url != "https://example.com/x" || q != "what" || mode != "digest" || !rec || noCtx {
t.Fatalf("%q %q %q rec=%v", url, q, mode, rec)
}
}
func TestParseFetchFlagsBeforeURL(t *testing.T) {
url, _, _, q, _, _, _, err := parseFetchArgs([]string{"--question", "why", "https://example.com/y"})
if err != nil {
t.Fatal(err)
}
if url != "https://example.com/y" || q != "why" {
t.Fatalf("%q %q", url, q)
}
}
func TestParseFetchRejectsExtraPositional(t *testing.T) {
_, _, _, _, _, _, _, err := parseFetchArgs([]string{"https://example.com/a", "https://example.com/b"})
if err == nil {
t.Fatal("want error")
}
}