Documentation ¶
Overview ¶
Package matcher for matching utilities
Index ¶
- Constants
- func AddHTTPBodyToMap(body string, m map[string][]string) error
- func ArrayToMap(arr []string) map[string]bool
- func CheckStringExist(s string, mp map[string][]string) ([]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 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 ToString(val interface{}) string
- 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 ¶
const MAX_LINE_LENGTH = 50
MAX_LINE_LENGTH is chars PER expected/actual string. Can be changed no problem
Variables ¶
This section is empty.
Functions ¶
func ArrayToMap ¶
func CompareHeaders ¶
func CompareResponses ¶
func CompareResponses(response1, response2 *interface{}, key string)
CompareResponses compares the two responses, if there is any difference in the values, It checks in the templatized values map if the value is already present, it will update the value in the map. It also changes the expected value to the actual value in the response1 (expected body)
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 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.
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