mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 10:12:06 +03:00
d96284da64
Add comment edit command This commit adds the comment edit command, which provides a CLI tool that allows a user to edit a comment.
28 lines
790 B
Go
28 lines
790 B
Go
package bug
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/MichaelMure/git-bug/entity"
|
|
)
|
|
|
|
func TestCommentId(t *testing.T) {
|
|
bugId := entity.Id("abcdefghijklmnopqrstuvwxyz1234__________")
|
|
opId := entity.Id("ABCDEFGHIJ______________________________")
|
|
expectedId := entity.Id("aAbBcCdefDghijEklmnFopqrGstuvHwxyzI1234J")
|
|
|
|
mergedId := DeriveCommentId(bugId, opId)
|
|
require.Equal(t, expectedId, mergedId)
|
|
|
|
// full length
|
|
splitBugId, splitCommentId := SplitCommentId(mergedId.String())
|
|
require.Equal(t, string(bugId[:30]), splitBugId)
|
|
require.Equal(t, string(opId[:10]), splitCommentId)
|
|
|
|
splitBugId, splitCommentId = SplitCommentId(string(expectedId[:6]))
|
|
require.Equal(t, string(bugId[:3]), splitBugId)
|
|
require.Equal(t, string(opId[:3]), splitCommentId)
|
|
}
|