aboutsummaryrefslogtreecommitdiffstats
path: root/commands/add_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/add_test.go')
-rw-r--r--commands/add_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/commands/add_test.go b/commands/add_test.go
new file mode 100644
index 00000000..63eda06e
--- /dev/null
+++ b/commands/add_test.go
@@ -0,0 +1,32 @@
+package commands
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func newTestEnvUserAndBug(t *testing.T) (*testEnv, string, string) {
+ t.Helper()
+
+ testEnv, userID := newTestEnvAndUser(t)
+ opts := addOptions{
+ title: "this is a bug title",
+ message: "this is a bug message",
+ messageFile: "",
+ nonInteractive: true,
+ }
+
+ require.NoError(t, runAdd(testEnv.env, opts))
+ require.Regexp(t, "^[0-9A-Fa-f]{7} created\n$", testEnv.out)
+ bugID := strings.Split(testEnv.out.String(), " ")[0]
+ testEnv.out.Reset()
+
+ return testEnv, userID, bugID
+}
+
+func TestAdd(t *testing.T) {
+ _, _, user := newTestEnvUserAndBug(t)
+ require.Regexp(t, "^[0-9A-Fa-f]{7}$", user)
+}