add frame required in action

This commit is contained in:
Linh Vo 2017-06-21 14:53:01 -05:00
parent 9fd1de8f29
commit 56c16e923a
2 changed files with 10 additions and 0 deletions

View file

@ -282,6 +282,9 @@ func (i *InputDefinition) AddFrame(frame InputFrame) error {
}
func (i *InputDefinition) ValidateAction(action *internal.Action) error {
if action.Frame == "" {
return ErrFrameRequired
}
validValues := make(map[string]bool)
for _, val := range ValidValueDestination {
validValues[val] = true

View file

@ -143,4 +143,11 @@ func TestInputDefinition_LoadDefinition(t *testing.T) {
if !strings.Contains(err.Error(), "duplicate rowID with other field") {
t.Fatalf("Expected duplicate rowID with other field error, actual error: %s", err)
}
action = internal.Action{ValueDestination: "single-row-boolean", RowID: 100}
def = &internal.InputDefinition{Name: "test", Frames: []*internal.Frame{&frames}, Fields: []*internal.InputDefinitionField{&field}}
err = input.LoadDefinition(def)
if !strings.Contains(err.Error(), "frame required") {
t.Fatalf("Expected frame required error, actual error: %s", err)
}
}