tracker/bittorrent/event_test.go
Jimmy Zelinskie 778773cb81 rm copyright
2016-08-16 22:17:10 -04:00

29 lines
625 B
Go

package bittorrent
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNew(t *testing.T) {
var table = []struct {
data string
expected Event
expectedErr error
}{
{"", None, nil},
{"NONE", None, nil},
{"none", None, nil},
{"started", Started, nil},
{"stopped", Stopped, nil},
{"completed", Completed, nil},
{"notAnEvent", None, ErrUnknownEvent},
}
for _, tt := range table {
got, err := NewEvent(tt.data)
assert.Equal(t, err, tt.expectedErr, "errors should equal the expected value")
assert.Equal(t, got, tt.expected, "events should equal the expected value")
}
}