Added a couple of tests
@@ -18,3 +18,20 @@ func TestNewInstanceOfDefinition(t *testing.T) {
assert.IsType(t, &api.Definition{}, instance)
assert.True(t, instance.Active)
}
+
+func TestSuccessfulValidation(t *testing.T) {
+ instance := api.NewDefinition()
+ instance.Name = "Test"
+ isValid, err := instance.Validate()
+
+ assert.NoError(t, err)
+ assert.True(t, isValid)
+}
+
+func TestFailedValidation(t *testing.T) {
+ instance := api.NewDefinition()
+ isValid, err := instance.Validate()
+
+ assert.Error(t, err)
+ assert.False(t, isValid)
+}
