omagrab/main_test.go
28allday 1febf47dcb Initial commit: omagrab v0.1.0
A yt-dlp TUI for Omarchy. Dual-mode (audio/video) paste-and-queue
downloader built with Go + Bubble Tea. Live progress, config view,
clipboard launch, and an install.sh that pulls in yt-dlp/ffmpeg/wl-clipboard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 18:53:53 +01:00

28 lines
881 B
Go

package main
import "testing"
func TestNormalizeArgURL(t *testing.T) {
want := "https://example.com/watch?v=abc123&t=10s"
cases := map[string]string{
"plain https": want,
"omagrab scheme": "omagrab:https%3A%2F%2Fexample.com%2Fwatch%3Fv%3Dabc123%26t%3D10s",
"omagrab slashes": "omagrab://https%3A%2F%2Fexample.com%2Fwatch%3Fv%3Dabc123%26t%3D10s",
"unescaped scheme": "omagrab:https://example.com/watch?v=abc123&t=10s",
}
for name, in := range cases {
if got := normalizeArgURL(in); got != want {
t.Errorf("%s: normalizeArgURL(%q) = %q, want %q", name, in, got, want)
}
}
for name, in := range map[string]string{
"junk": "not a url",
"ftp": "ftp://example.com",
"empty": "",
"scheme only": "omagrab:",
} {
if got := normalizeArgURL(in); got != "" {
t.Errorf("%s: normalizeArgURL(%q) = %q, want empty", name, in, got)
}
}
}