fdktest

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GZIPReader added in v0.23.1

func GZIPReader(t *testing.T, v string) io.Reader

GZIPReader is a helper for gzipping the contents and returning the reader.

func NewLogger added in v0.23.1

func NewLogger(t *testing.T) *slog.Logger

NewLogger creates a new logger that integrates with the testing.T logging.

func RequestOf added in v0.23.1

func RequestOf[T any](t *testing.T, r fdk.RequestOf[T]) fdk.Request

RequestOf converts a RequestOf into its fdk.Request equivalent. I.e. creates the json payload.

func Want added in v0.23.1

func Want(t *testing.T, got fdk.Response, wants ...WantFn)

Want runs a set of want fns upon hte response type.

Types

type WantFn added in v0.23.1

type WantFn func(t *testing.T, got fdk.Response)

WantFn defines the assertions for a response.

func WantCode added in v0.23.1

func WantCode(want int) WantFn

WantCode verifies the status matches desired.

func WantErrs added in v0.23.1

func WantErrs(wants ...fdk.APIError) WantFn

WantErrs compares verifies the errors received from teh response match the desired.

func WantFileMatch added in v0.23.1

func WantFileMatch(want fdk.File) WantFn

WantFileMatch verifies the contents of the response body are a fdk.File type and have matching contents.

func WantGzipFileMatch added in v0.23.1

func WantGzipFileMatch(want fdk.File) WantFn

WantGzipFileMatch compares the wanted file (if encoded will decode) and then compare it with the decoded returned file.

func WantNoErrs added in v0.23.1

func WantNoErrs() WantFn

WantNoErrs verifies there are no errors returned.

Jump to

Keyboard shortcuts

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