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

Function TestUnuse

cmd/unuse_test.go:13–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

UnuseFunction · 0.85
trimFunction · 0.85
ExecuteMethod · 0.80

Tested by

no test coverage detected