2019-03-13 04:14:30 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMapSegmentWriterCanMap(t *testing.T) {
|
|
|
|
sc := &Segment{
|
|
|
|
Type: Session,
|
|
|
|
}
|
|
|
|
env := new(MockedEnvironment)
|
2020-09-17 07:51:29 -07:00
|
|
|
props, err := sc.mapSegmentWithWriter(env)
|
|
|
|
assert.NotNil(t, props)
|
|
|
|
assert.NoError(t, err)
|
2019-03-13 04:14:30 -07:00
|
|
|
assert.NotNil(t, sc.writer)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMapSegmentWriterCannotMap(t *testing.T) {
|
|
|
|
sc := &Segment{
|
|
|
|
Type: "nilwriter",
|
|
|
|
}
|
|
|
|
env := new(MockedEnvironment)
|
2020-09-17 07:51:29 -07:00
|
|
|
props, err := sc.mapSegmentWithWriter(env)
|
|
|
|
assert.Nil(t, props)
|
|
|
|
assert.Error(t, err)
|
2019-03-13 04:14:30 -07:00
|
|
|
}
|