github.com/TIBCOSoftware/flogo-lib@v0.5.9/flogo/support_test.go (about) 1 package flogo 2 3 import ( 4 "github.com/TIBCOSoftware/flogo-lib/core/data" 5 "github.com/stretchr/testify/assert" 6 "testing" 7 ) 8 9 func TestGetMappingValue(t *testing.T) { 10 11 //todo add additional tests when support for more mapping type is added 12 mType, mValue := getMappingValue("$.value") 13 14 assert.Equal(t, data.MtExpression, mType) 15 assert.Equal(t, "$.value", mValue) 16 } 17 18 func TestToMappings(t *testing.T) { 19 20 mappings := []string{"in1=b", "in2= $.blah", "in3 = $.blah2"} 21 22 //todo add additional tests when support for more mapping type is added 23 defs, err := toMappingDefs(mappings) 24 25 assert.Nil(t, err) 26 assert.Equal(t, 3, len(defs)) 27 28 assert.Equal(t, "in1", defs[0].MapTo) 29 assert.Equal(t, "in2", defs[1].MapTo) 30 assert.Equal(t, "in3", defs[2].MapTo) 31 32 assert.Equal(t, data.MtExpression, defs[0].Type) 33 assert.Equal(t, data.MtExpression, defs[1].Type) 34 assert.Equal(t, data.MtExpression, defs[2].Type) 35 36 assert.Equal(t, "b", defs[0].Value) 37 assert.Equal(t, "$.blah", defs[1].Value) 38 assert.Equal(t, "$.blah2", defs[2].Value) 39 40 }