testing

package
Version: v4.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscardLogging

func DiscardLogging() (restore func())

DiscardLogging sets the global Logrus output to utils.Discard

func JSONEq

func JSONEq(t require.TestingT, expected string, actual string, msgAndArgs ...interface{})

JSONEq asserts that two JSON strings are equivalent or both empty.

require.JSONEq(t, "", "")
or
require.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)

func SetupLoggingBuffer

func SetupLoggingBuffer() (buf *bytes.Buffer, restore func())

SetupLoggingBuffer creates an empty buffer and sets it as a Logrus output globally. Returns the created buffer so you can check what was logged.

func ToJSONBytes

func ToJSONBytes(t *testing.T, obj interface{}) []byte

ToJSONBytes converts any structure to a byte slice of its JSON representation

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL