assertion

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyHTTP added in v1.1.0

func AnyHTTP(assertions []Assertion) bool

AnyHTTP returns true if the assertions contains at least one HTTP assertion

Types

type Assertion

type Assertion interface {
	Setup() error
	Assert() error
}

type HTTP added in v1.0.2

type HTTP struct {
	// Request will assert if request was made with correct parameters
	Request expect.Request
	// Response mocks a fake response to avoid your test making real http request over the internet
	Response mock.Response
}

HTTP asserts a http request

func (*HTTP) Assert added in v1.0.2

func (a *HTTP) Assert() error

Setup does not do anything because the assertions are created on the setup for the HTTP

func (*HTTP) Setup added in v1.0.2

func (a *HTTP) Setup() error

Setup sets up if request will be called as expected

type SQL added in v1.0.2

type SQL struct {
	// DB database used to query the data to assert
	DB *sql.DB
	// Query that will run in the database
	Query call.Query
	// Result expects result in json that will be returned when the query run
	Result expect.Result
}

SQL asserts a SQL query

func (*SQL) Assert added in v1.0.2

func (a *SQL) Assert() error

Assert checks if query returns the expected result Reference: https://kylewbanks.com/blog/query-result-to-map-in-golang

func (*SQL) Setup added in v1.0.2

func (a *SQL) Setup() error

Setup does not do anything because it doesn't need

Jump to

Keyboard shortcuts

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