|
@ -78,6 +78,10 @@ func TestTranslateStep(t *testing.T) { |
|
|
assert.Equal(t, 1, len(steps), "Output steps should contain one element") |
|
|
assert.Equal(t, 1, len(steps), "Output steps should contain one element") |
|
|
assert.Equal(t, "resize image", steps[0].GetName()) |
|
|
assert.Equal(t, "resize image", steps[0].GetName()) |
|
|
assert.Equal(t, TypeResizeImageStep, steps[0].GetType()) |
|
|
assert.Equal(t, TypeResizeImageStep, steps[0].GetType()) |
|
|
|
|
|
|
|
|
|
|
|
translated, err := steps[0].Translate() |
|
|
|
|
|
assert.Equal(t, err, nil) |
|
|
|
|
|
assert.IsType(t, ResizeImageStep{}, translated) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -89,7 +93,7 @@ func TestInvalidStepType(t *testing.T) { |
|
|
"steps": [ |
|
|
"steps": [ |
|
|
{ |
|
|
{ |
|
|
"name": "resize image", |
|
|
"name": "resize image", |
|
|
"type": 0 |
|
|
|
|
|
|
|
|
"type": 99999 |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
}` |
|
|
}` |
|
@ -101,6 +105,10 @@ func TestInvalidStepType(t *testing.T) { |
|
|
|
|
|
|
|
|
assert.Equal(t, 1, len(steps), "Output steps should contain one element") |
|
|
assert.Equal(t, 1, len(steps), "Output steps should contain one element") |
|
|
assert.Equal(t, "resize image", steps[0].GetName()) |
|
|
assert.Equal(t, "resize image", steps[0].GetName()) |
|
|
assert.Equal(t, TypeResizeImageStep, steps[0].GetType()) |
|
|
|
|
|
|
|
|
assert.Equal(t, StepType(99999), steps[0].GetType()) |
|
|
|
|
|
|
|
|
|
|
|
translated, err := steps[0].Translate() |
|
|
|
|
|
assert.EqualError(t, err, "invalid type") |
|
|
|
|
|
assert.Nil(t, translated) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |