fix: address verified review findings (cli-core-1)

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-18 17:38:52 +02:00
1 parent a47dbc413c
commit e15ea907be
12 files changed
+181 -21

No files matched your search

+14
View File
@@ -4,6 +4,8 @@
package app
import (
"math"
"strconv"
"testing"
"time"
@@ -93,6 +95,9 @@ func TestArgumentErrorsShowTheUsageLine(t *testing.T) {
{[]string{"pr", "checkout"}, "missing pull request number\nUsage: tea pr checkout {<number> | <url> | <branch>} [flags]"},
{[]string{"run", "view"}, "missing run ID\nUsage: tea run view [<run-id>] [flags]"},
{[]string{"release", "asset", "edit", "v1"}, "missing asset\nUsage: tea release asset edit <tag> <asset> [flags]"},
{[]string{"time", "create"}, "missing issue number\nUsage: tea time create {<number> | <url>} <duration> [flags]"},
{[]string{"milestone", "issue", "add", "v1.0"}, "missing issue number\nUsage: tea milestone issue add <milestone> {<number> | <url>}... [flags]"},
{[]string{"branch", "protect", "main", "--pattern", "release/*"}, "--pattern cannot be combined with branch names\nUsage: tea branch protect <branch>... [flags]"},
{[]string{"repo", "clone"}, "missing repository\nUsage: tea repo clone <repository> [<directory>] [-- <gitflags>...] [flags]"},
} {
requireUsageBeforeRequests(t, tc.want, tc.args...)
@@ -108,3 +113,12 @@ func TestLimitAcceptsShorthandUpToOneThousand(t *testing.T) {
require.Equal(t, 1000, limit)
require.ErrorContains(t, cmd.Flags().Parse([]string{"-L", "1001"}), "must be 1..1000")
}
func TestPageRejectsValuesThatOverflowTheOffset(t *testing.T) {
var limit, page int
cmd := &cobra.Command{Use: "list"}
pageFlags(cmd, &limit, &page)
require.NoError(t, cmd.Flags().Parse([]string{"--page", strconv.Itoa(maxPage)}))
require.Equal(t, maxPage, page)
require.ErrorContains(t, cmd.Flags().Parse([]string{"--page", strconv.Itoa(math.MaxInt)}), "--page")
}