mirror of
https://github.com/MichaelMure/git-bug.git
synced 2025-01-05 17:33:12 +03:00
34 lines
742 B
Go
34 lines
742 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func newTestEnvAndBugWithComment(t *testing.T) (*testEnv, string, string) {
|
|
t.Helper()
|
|
|
|
env, bugID := newTestEnvAndBug(t)
|
|
|
|
opts := commentAddOptions{
|
|
message: "this is a bug comment",
|
|
}
|
|
require.NoError(t, runCommentAdd(env.env, opts, []string{bugID}))
|
|
require.NoError(t, runComment(env.env, []string{bugID}))
|
|
comments := parseComments(t, env)
|
|
require.Len(t, comments, 2)
|
|
|
|
env.out.Reset()
|
|
|
|
return env, bugID, comments[1].id
|
|
}
|
|
|
|
func TestCommentAdd(t *testing.T) {
|
|
const golden = "testdata/comment/add"
|
|
|
|
env, bugID, _ := newTestEnvAndBugWithComment(t)
|
|
require.NoError(t, runComment(env.env, []string{bugID}))
|
|
requireCommentsEqual(t, golden, env)
|
|
}
|