MCPcopy Index your code
hub / github.com/cli/cli / TestNewCmdList

Function TestNewCmdList

pkg/cmd/cache/list/list_test.go:20–127  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func TestNewCmdList(t *testing.T) {
21 tests := []struct {
22 name string
23 input string
24 wants ListOptions
25 wantsErr string
26 }{
27 {
28 name: "no arguments",
29 input: "",
30 wants: ListOptions{
31 Limit: 30,
32 Order: "desc",
33 Sort: "last_accessed_at",
34 Key: "",
35 Ref: "",
36 },
37 },
38 {
39 name: "with limit",
40 input: "--limit 100",
41 wants: ListOptions{
42 Limit: 100,
43 Order: "desc",
44 Sort: "last_accessed_at",
45 Key: "",
46 Ref: "",
47 },
48 },
49 {
50 name: "invalid limit",
51 input: "-L 0",
52 wantsErr: "invalid limit: 0",
53 },
54 {
55 name: "with sort",
56 input: "--sort created_at",
57 wants: ListOptions{
58 Limit: 30,
59 Order: "desc",
60 Sort: "created_at",
61 Key: "",
62 Ref: "",
63 },
64 },
65 {
66 name: "with order",
67 input: "--order asc",
68 wants: ListOptions{
69 Limit: 30,
70 Order: "asc",
71 Sort: "last_accessed_at",
72 Key: "",
73 Ref: "",
74 },
75 },
76 {
77 name: "with key",

Callers

nothing calls this directly

Calls 3

EqualMethod · 0.80
NewCmdListFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected