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

Function TestUse

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

Source from the content-addressed store, hash-verified

12)
13
14func TestUse(t *testing.T) {
15 is := is.New(t)
16
17 cfg := &storageMock{
18 LenFunc: func() int {
19 return 1
20 },
21 LookupFunc: func(name string) ([]config.Entry, bool) {
22 return []config.Entry{
23 {Key: "user.email", Value: "work@example.com"},
24 }, true
25 },
26 }
27
28 vcs := &vcsMock{
29 IsRepositoryFunc: func() bool {
30 return true
31 },
32 SetFunc: func(key string, value string) error {
33 return nil
34 },
35 }
36
37 var b bytes.Buffer
38
39 cmd := Use(cfg, vcs)
40
41 cmd.SetOut(&b)
42 cmd.SetArgs([]string{"profile"})
43 err := cmd.Execute()
44
45 is.NoErr(err)
46 is.Equal(trim(b.String()), "Successfully applied `profile` profile to current git repository.")
47}
48
49func TestProfileResolveInteractive(t *testing.T) {
50 is := is.New(t)

Callers

nothing calls this directly

Calls 3

UseFunction · 0.85
trimFunction · 0.85
ExecuteMethod · 0.80

Tested by

no test coverage detected