-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
134929e
commit f9e0477
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package event_types_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/lucaschain/beholder/core/event_types" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestFromString(t *testing.T) { | ||
t.Run("should return event type from string", func(t *testing.T) { | ||
assert.Equal(t, event_types.Create, event_types.FromString("CREATE")) | ||
assert.Equal(t, event_types.Write, event_types.FromString("WRITE")) | ||
assert.Equal(t, event_types.Remove, event_types.FromString("REMOVE")) | ||
assert.Equal(t, event_types.Rename, event_types.FromString("RENAME")) | ||
assert.Equal(t, event_types.Chmod, event_types.FromString("CHMOD")) | ||
}) | ||
t.Run("should return empty event type when string is invalid", func(t *testing.T) { | ||
assert.Equal(t, event_types.EventType(""), event_types.FromString("INVALID")) | ||
}) | ||
} |