test

package
v0.0.0-...-eb599cc Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct {
	// contains filtered or unexported fields
}

Mock provides various helpers to unit tests

func NewMock

func NewMock(t *testing.T) (*Mock, context.Context)

NewMock sets up a new test environment

func (*Mock) Allow

func (m *Mock) Allow(rpc RPC) *Stub

Allow sets up a stub for the RPC that allows any number of requests

func (*Mock) ExpectN

func (m *Mock) ExpectN(n int, rpc RPC) *Stub

ExpectN sets up a stub for the RPC that expects n matching requests

func (*Mock) ExpectOne

func (m *Mock) ExpectOne(rpc RPC) *Stub

ExpectOne sets up a stub for the RPC that expects one matching request

func (*Mock) RunAssertions

func (m *Mock) RunAssertions()

RunAssertions asserts that the expectations have been met

func (*Mock) Stop

func (m *Mock) Stop()

Stop performs cleanup and should be deferred in unit tests

type RPC

type RPC interface {
	Request() *rpc.Request
}

RPC is an interface that svcdef request types conform to

Jump to

Keyboard shortcuts

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