Skip to content

Commit

Permalink
test: add ChangeType tests
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago M. Mola <[email protected]>
  • Loading branch information
smola committed Dec 10, 2018
1 parent bdf797a commit 0c217e1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions changes_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package compat

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestChangeTypeString(t *testing.T) {
require := require.New(t)
for i := 1; i < len(_ChangeType_index); i++ {
expected := ChangeType(i)
actual, err := ChangeTypeFromString(expected.String())
require.NoError(err)
require.Equal(expected, actual)
}
}

func TestChangeTypeStringError(t *testing.T) {
require := require.New(t)
for i := 0; i < len(_ChangeType_index); i++ {
actual, err := ChangeTypeFromString("BADTYPE")
require.Error(err)
require.Zero(actual)
}
}

0 comments on commit 0c217e1

Please sign in to comment.