aboutsummaryrefslogtreecommitdiffstats
path: root/commands/comment_edit_test.go
diff options
context:
space:
mode:
authorSteve Moyer <smoyer1@selesy.com>2022-08-19 13:19:02 -0400
committerSteve Moyer <smoyer1@selesy.com>2022-08-19 13:19:02 -0400
commit7a91eb7e1d20bf99ce4fa9d751c02b7b4d100d45 (patch)
tree6bd3f6e87eb8624b1daa5200b5bf26ec3a58cafb /commands/comment_edit_test.go
parent5ca686b59751e3c87740b84108c54fc675a074cf (diff)
downloadgit-bug-7a91eb7e1d20bf99ce4fa9d751c02b7b4d100d45.tar.gz
tests(850): add tests for comment ls, add and edit
Diffstat (limited to 'commands/comment_edit_test.go')
-rw-r--r--commands/comment_edit_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/commands/comment_edit_test.go b/commands/comment_edit_test.go
new file mode 100644
index 00000000..191a089c
--- /dev/null
+++ b/commands/comment_edit_test.go
@@ -0,0 +1,36 @@
+package commands
+
+import (
+ "testing"
+
+ "github.com/MichaelMure/git-bug/bug"
+ "github.com/stretchr/testify/require"
+)
+
+func TestCommentEdit(t *testing.T) {
+ const golden = "testdata/comment/edit"
+
+ env, bugID, commentID := newTestEnvAndBugWithComment(t)
+
+ opts := commentEditOptions{
+ message: "this is an altered bug comment",
+ }
+ require.NoError(t, runCommentEdit(env.env, opts, []string{commentID}))
+
+ // TODO: remove this comment and everything between the "snip"
+ // comments when issue #850 is resolved.
+
+ // ***** snip *****
+ cache, err := env.env.backend.ResolveBugPrefix(bugID)
+ require.NoError(t, err)
+ bu, err := bug.Read(env.env.repo, cache.Id())
+ require.NoError(t, err)
+ for _, op := range bu.Operations() {
+ t.Log("Operation: ", op)
+ }
+ t.Log("Compiled comments: ", bu.Compile().Comments)
+ // ***** snip *****
+
+ require.NoError(t, runComment(env.env, []string{bugID}))
+ requireCommentsEqual(t, golden, env)
+}