aboutsummaryrefslogtreecommitdiffstats
path: root/commands/user_create_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/user_create_test.go')
-rw-r--r--commands/user_create_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/commands/user_create_test.go b/commands/user_create_test.go
new file mode 100644
index 00000000..223e7ec3
--- /dev/null
+++ b/commands/user_create_test.go
@@ -0,0 +1,36 @@
+package commands
+
+import (
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func newTestEnvAndUser(t *testing.T) (*testEnv, string) {
+ t.Helper()
+
+ testEnv := newTestEnv(t)
+
+ opts := createUserOptions{
+ name: "John Doe",
+ email: "jdoe@example.com",
+ avatarURL: "",
+ nonInteractive: true,
+ }
+
+ require.NoError(t, runUserCreate(testEnv.env, opts))
+
+ userID := strings.TrimSpace(testEnv.out.String())
+ testEnv.out.Reset()
+
+ return testEnv, userID
+}
+
+func TestUserCreateCommand(t *testing.T) {
+ testEnv, userID := newTestEnvAndUser(t)
+
+ require.FileExists(t, filepath.Join(testEnv.cwd, ".git", "refs", "identities", userID))
+ require.FileExists(t, filepath.Join(testEnv.cwd, ".git", "git-bug", "identity-cache"))
+}