Documentation
¶
Overview ¶
Package matcher for matching utilities
Index ¶
- func AddHTTPBodyToMap(body string, m map[string][]string) error
- func ArrayToMap(arr []string) map[string]bool
- func CompareHeaders(h1 http.Header, h2 http.Header, res *[]models.HeaderResult, ...) bool
- func CompareResponses(response1, response2 *interface{}, key string)
- func Contains(elems []string, v string) bool
- func FindOperation(item models.PathItem) (*models.Operation, string)
- func Flatten(j interface{}) map[string][]string
- func InterfaceToString(val interface{}) string
- func JsonContains(actualJSON string, expectedJSON map[string]interface{}) (bool, error)
- func MapToArray(mp map[string][]string) []string
- func MarshalRequestBodies(mockOperation, testOperation *models.Operation) (string, string, error)
- func MarshalResponseBodies(status string, mockOperation, testOperation *models.Operation) (string, string, error)
- func MatchesAnyRegex(str string, regexArray []string) (bool, string)
- func ParseIntoJSON(response string) (interface{}, error)
- func SubstringKeyMatch(s string, mp map[string][]string) ([]string, bool)
- func UnmarshallJSON(s string, log *zap.Logger) (interface{}, error)
- type DiffsPrinter
- func (d *DiffsPrinter) PushBodyDiff(exp, act string, noise map[string][]string)
- func (d *DiffsPrinter) PushFooterDiff(key string)
- func (d *DiffsPrinter) PushHeaderDiff(exp, act, key string, noise map[string][]string)
- func (d *DiffsPrinter) PushStatusDiff(exp, act string)
- func (d *DiffsPrinter) PushTypeDiff(exp, act string)
- func (d *DiffsPrinter) Render() error
- func (d *DiffsPrinter) RenderAppender() error
- func (d *DiffsPrinter) SetHasarrayIndexMismatch(has bool)
- func (d *DiffsPrinter) TableWriter(diffs []string) error
- type JSONComparisonResult
- type ValidatedJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayToMap ¶
func CompareHeaders ¶
func CompareResponses ¶
func CompareResponses(response1, response2 *interface{}, key string)
CompareResponses compares response1 (expected) and response2 (actual), updating utils.TemplatizedValues and mutating response1 where appropriate.
func Flatten ¶
Flatten takes a map and returns a new one where nested maps are replaced by dot-delimited keys. examples of valid jsons - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#examples
func InterfaceToString ¶
func InterfaceToString(val interface{}) string
func JsonContains ¶ added in v2.5.3
func MapToArray ¶
func MarshalRequestBodies ¶
func MarshalResponseBodies ¶
func ParseIntoJSON ¶
ParseIntoJSON Parse the json string into a geko type variable, it will maintain the order of the keys in the json.
func SubstringKeyMatch ¶ added in v2.6.21
Types ¶
type DiffsPrinter ¶
type DiffsPrinter struct {
// contains filtered or unexported fields
}
func NewDiffsPrinter ¶
func NewDiffsPrinter(testCase string) DiffsPrinter
func (*DiffsPrinter) PushBodyDiff ¶
func (d *DiffsPrinter) PushBodyDiff(exp, act string, noise map[string][]string)
func (*DiffsPrinter) PushFooterDiff ¶
func (d *DiffsPrinter) PushFooterDiff(key string)
func (*DiffsPrinter) PushHeaderDiff ¶
func (d *DiffsPrinter) PushHeaderDiff(exp, act, key string, noise map[string][]string)
func (*DiffsPrinter) PushStatusDiff ¶
func (d *DiffsPrinter) PushStatusDiff(exp, act string)
func (*DiffsPrinter) PushTypeDiff ¶
func (d *DiffsPrinter) PushTypeDiff(exp, act string)
func (*DiffsPrinter) Render ¶
func (d *DiffsPrinter) Render() error
Render will display and colorize diffs side-by-side
func (*DiffsPrinter) RenderAppender ¶
func (d *DiffsPrinter) RenderAppender() error
func (*DiffsPrinter) SetHasarrayIndexMismatch ¶
func (d *DiffsPrinter) SetHasarrayIndexMismatch(has bool)
func (*DiffsPrinter) TableWriter ¶
func (d *DiffsPrinter) TableWriter(diffs []string) error
type JSONComparisonResult ¶
type JSONComparisonResult struct {
// contains filtered or unexported fields
}
func JSONDiffWithNoiseControl ¶
func JSONDiffWithNoiseControl(validatedJSON ValidatedJSON, noise map[string][]string, ignoreOrdering bool) (JSONComparisonResult, error)
func (*JSONComparisonResult) Differences ¶
func (v *JSONComparisonResult) Differences() []string
func (*JSONComparisonResult) IsExact ¶
func (v *JSONComparisonResult) IsExact() bool
func (*JSONComparisonResult) Matches ¶
func (v *JSONComparisonResult) Matches() bool
type ValidatedJSON ¶
type ValidatedJSON struct {
// contains filtered or unexported fields
}
func ValidateAndMarshalJSON ¶
func ValidateAndMarshalJSON(log *zap.Logger, exp, act *string) (ValidatedJSON, error)
func (*ValidatedJSON) Actual ¶
func (v *ValidatedJSON) Actual() interface{}
func (*ValidatedJSON) Expected ¶
func (v *ValidatedJSON) Expected() interface{}
func (*ValidatedJSON) IsIdentical ¶
func (v *ValidatedJSON) IsIdentical() bool
Click to show internal directories.
Click to hide internal directories.