1package commands
2
3import (
4 "path/filepath"
5 "strings"
6 "testing"
7
8 "github.com/stretchr/testify/require"
9)
10
11func newTestEnvAndUser(t *testing.T) (*testEnv, string) {
12 t.Helper()
13
14 testEnv := newTestEnv(t)
15
16 opts := createUserOptions{
17 name: "John Doe",
18 email: "jdoe@example.com",
19 avatarURL: "",
20 nonInteractive: true,
21 }
22
23 require.NoError(t, runUserCreate(testEnv.env, opts))
24
25 userID := strings.TrimSpace(testEnv.out.String())
26 testEnv.out.Reset()
27
28 return testEnv, userID
29}
30
31func TestUserCreateCommand(t *testing.T) {
32 testEnv, userID := newTestEnvAndUser(t)
33
34 require.FileExists(t, filepath.Join(testEnv.cwd, ".git", "refs", "identities", userID))
35 require.FileExists(t, filepath.Join(testEnv.cwd, ".git", "git-bug", "identity-cache"))
36}