Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ExpectFieldIsValid = func(object map[string]interface{}, field string, val interface{}) { object[field] = val testContext, err := context.NewStandard(test.NewLogger()) gomega.Expect(err).To(gomega.BeNil()) standardValidator, err := validator.NewStandard(testContext) gomega.Expect(err).To(gomega.BeNil()) objectParser, err := parser.NewStandardObject(testContext, &object, parser.IgnoreNotParsed) gomega.Expect(err).To(gomega.BeNil()) reportAndFailOnErrors(testContext, "Initialization:") parsedObject, err := types.Parse(objectParser) gomega.Expect(err).To(gomega.BeNil()) reportAndFailOnErrors(testContext, "Parsing:") parsedObject.Validate(standardValidator) reportAndFailOnErrors(testContext, "Validation:") }
View Source
var ExpectFieldNotValid = func(object map[string]interface{}, field string, val interface{}, expectedErrors []*service.Error) { object[field] = val testContext, err := context.NewStandard(test.NewLogger()) gomega.Expect(err).To(gomega.BeNil()) standardValidator, err := validator.NewStandard(testContext) gomega.Expect(err).To(gomega.BeNil()) objectParser, err := parser.NewStandardObject(testContext, &object, parser.IgnoreNotParsed) gomega.Expect(err).To(gomega.BeNil()) reportAndFailOnErrors(testContext, "Initialization:") parsedObject, err := types.Parse(objectParser) gomega.Expect(err).To(gomega.BeNil()) parsedObject.Validate(standardValidator) gomega.Expect(testContext.Errors()).ToNot(gomega.BeEmpty()) gomega.Expect(testContext.Errors()).To(gomega.HaveLen(len(expectedErrors))) for _, expectedError := range expectedErrors { gomega.Expect(testContext.Errors()).To(gomega.ContainElement(expectedError)) } }
View Source
var ParseAndNormalize = func(object map[string]interface{}, field string, val interface{}) data.Datum { object[field] = val testContext, err := context.NewStandard(test.NewLogger()) gomega.Expect(err).To(gomega.BeNil()) standardValidator, err := validator.NewStandard(testContext) gomega.Expect(err).To(gomega.BeNil()) objectParser, err := parser.NewStandardObject(testContext, &object, parser.IgnoreNotParsed) gomega.Expect(err).To(gomega.BeNil()) reportAndFailOnErrors(testContext, "Initialization:") parsedObject, err := types.Parse(objectParser) gomega.Expect(err).To(gomega.BeNil()) reportAndFailOnErrors(testContext, "Parsing:") parsedObject.Validate(standardValidator) reportAndFailOnErrors(testContext, "Validate:") standardNormalizer, err := normalizer.NewStandard(testContext) gomega.Expect(err).To(gomega.BeNil()) parsedObject.Normalize(standardNormalizer) return parsedObject }
Functions ¶
func ComposeError ¶
func RawBaseObject ¶
func RawBaseObject() map[string]interface{}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.