MCPcopy Create free account
hub / github.com/dotzero/git-profile / TestList

Function TestList

cmd/list_test.go:12–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestList(t *testing.T) {
13 is := is.New(t)
14
15 cfg := &storageMock{
16 LenFunc: func() int {
17 return 1
18 },
19 NamesFunc: func() []string {
20 return []string{"home"}
21 },
22 LookupFunc: func(name string) ([]config.Entry, bool) {
23 return []config.Entry{
24 {Key: "user.email", Value: "work@example.com"},
25 }, true
26 },
27 }
28
29 vcs := &vcsMock{
30 IsRepositoryFunc: func() bool {
31 return true
32 },
33 GetFunc: func(key string) (string, error) {
34 return "home", nil
35 },
36 }
37
38 var b bytes.Buffer
39
40 cmd := List(cfg, vcs)
41
42 cmd.SetOut(&b)
43 err := cmd.Execute()
44
45 is.NoErr(err)
46 is.Equal(trim(b.String()), "Available profiles:\n- home:\n user.email: work@example.com")
47}

Callers

nothing calls this directly

Calls 3

ListFunction · 0.85
trimFunction · 0.85
ExecuteMethod · 0.80

Tested by

no test coverage detected