expectm

package
v0.0.0-...-c537d22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDate

func CheckDate(expectedStr string, format string) func(json interface{}) error

func CheckDateClose

func CheckDateClose(target time.Time, leeway time.Duration) func(json interface{}) error

Example:

test := {
  bodyShouldHave: ExpectedM{
     "created": CheckDateClose(time.Now(), time.Second),
  }

func CheckExpectedM

func CheckExpectedM(result gjson.Result, expected *ExpectedM) error

func CheckGJSONLength

func CheckGJSONLength(k string, expectedValue, actualValue interface{}) error

func CheckJSON

func CheckJSON(obj interface{}, expected *ExpectedM) error

func CheckJSONBytes

func CheckJSONBytes(js []byte, expected *ExpectedM) error

func CheckJSONString

func CheckJSONString(js string, expected *ExpectedM) error

func MustInt

func MustInt(val interface{}) (int, error)

Types

type ExpectedM

type ExpectedM map[string]interface{}

This custom type is so you can't accidentally pass in the wrong map to a function that compares two mars EG: checkJSON(sentJSON, sentJSON) won't compile if the function expects ExpectedM as the 2nd parameter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL