diff options
author | Michael Muré <batolettre@gmail.com> | 2018-10-01 11:37:37 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-10-01 11:37:37 +0200 |
commit | bda9b01b5a1e037b64e18d34bcf2c06904663942 (patch) | |
tree | 1627976c24b2e3a1fd568b36d44bdf6e879bc3d4 | |
parent | 3402230a5537d95ce26bf7fa0d33330823a59f08 (diff) | |
download | git-bug-bda9b01b5a1e037b64e18d34bcf2c06904663942.tar.gz |
bug: add a test for OpBase metadata
-rw-r--r-- | bug/operation_test.go | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/bug/operation_test.go b/bug/operation_test.go index 2bf836f0..13373761 100644 --- a/bug/operation_test.go +++ b/bug/operation_test.go @@ -2,19 +2,12 @@ package bug import ( "testing" - "time" "github.com/MichaelMure/git-bug/util/git" + "github.com/stretchr/testify/require" ) func TestValidate(t *testing.T) { - rene := Person{ - Name: "René Descartes", - Email: "rene@descartes.fr", - } - - unix := time.Now().Unix() - good := []Operation{ NewCreateOp(rene, unix, "title", "message", nil), NewSetTitleOp(rene, unix, "title2", "title1"), @@ -68,3 +61,13 @@ func TestValidate(t *testing.T) { } } } + +func TestMetadata(t *testing.T) { + op := NewCreateOp(rene, unix, "title", "message", nil) + + op.SetMetadata("key", "value") + + val, ok := op.GetMetadata("key") + require.True(t, ok) + require.Equal(t, val, "value") +} |