mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 03:27:10 +00:00
* refactor: rename inspect to replay across the codebase Renames inspect-ui/ to replay-ui/, internal/inspect/ to internal/replay/, the CLI subcommand from `sanderling inspect` to `sanderling replay`, and updates all references in docs, Makefile, README, and Go comments. * feat(replay-ui): show spec filename with full path on hover RunList and RunDetail now render the basename of spec_path (e.g. login.spec.ts) with the full path available as a title tooltip.
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestParseReplayArgs_Defaults(t *testing.T) {
|
|
options, err := parseReplayArgs(nil, io.Discard)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if options.port != 0 || options.noOpen || options.dev || options.directory != "" {
|
|
t.Errorf("unexpected defaults: %+v", options)
|
|
}
|
|
}
|
|
|
|
func TestParseReplayArgs_AllFlags(t *testing.T) {
|
|
options, err := parseReplayArgs([]string{"--port", "9090", "--no-open", "--dev", "/tmp/runs"}, io.Discard)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if options.port != 9090 || !options.noOpen || !options.dev || options.directory != "/tmp/runs" {
|
|
t.Errorf("unexpected options: %+v", options)
|
|
}
|
|
}
|
|
|
|
func TestParseReplayArgs_RejectsTooManyPositional(t *testing.T) {
|
|
_, err := parseReplayArgs([]string{"a", "b"}, io.Discard)
|
|
if err == nil || !strings.Contains(err.Error(), "at most one") {
|
|
t.Fatalf("expected too-many-args error, got %v", err)
|
|
}
|
|
}
|
|
|
|
func TestRun_HelpListsReplayCommand(t *testing.T) {
|
|
var stdout bytes.Buffer
|
|
if err := run([]string{"sanderling"}, &stdout, io.Discard); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.Contains(stdout.String(), "replay") {
|
|
t.Errorf("usage missing replay command: %q", stdout.String())
|
|
}
|
|
}
|