package cli

import (
	"strings"
	"testing"
)

func TestRunConfigReportsLocalOnly(t *testing.T) {
	err := runConfig(t.TempDir(), nil)
	if err == nil || !strings.Contains(err.Error(), "local-file-only") {
		t.Fatalf("expected local-file-only error, got %v", err)
	}

	err = runConfig(t.TempDir(), []string{"sync"})
	if err == nil || !strings.Contains(err.Error(), "unsupported subcommand \"sync\"") {
		t.Fatalf("expected unsupported subcommand error, got %v", err)
	}
}

func TestParseTime(t *testing.T) {
	if _, ok := parseTime("2026-05-28T12:00:00+08:00"); !ok {
		t.Fatal("expected RFC3339 time to parse")
	}
	if _, ok := parseTime("not-time"); ok {
		t.Fatal("expected invalid time")
	}
}
