barista.run: barista.run/testing/module Index | Files

package module

import "barista.run/testing/module"

Package module provides a test module that can be used in tests.

Index

Package Files

module.go

type TestModule Uses

type TestModule struct {
    sync.Mutex
    // contains filtered or unexported fields
}

TestModule represents a bar.Module used for testing.

func New Uses

func New(t require.TestingT) *TestModule

New creates a new module with the given testingT that can be used to assert the behaviour of the bar (or related modules).

func (*TestModule) AssertClicked Uses

func (t *TestModule) AssertClicked(args ...interface{}) bar.Event

AssertClicked asserts that the module was clicked and returns the event. Calling this multiple times asserts multiple click events.

func (*TestModule) AssertNotClicked Uses

func (t *TestModule) AssertNotClicked(args ...interface{})

AssertNotClicked asserts that the module received no events.

func (*TestModule) AssertNotStarted Uses

func (t *TestModule) AssertNotStarted(args ...interface{})

AssertNotStarted asserts that the module was not started.

func (*TestModule) AssertStarted Uses

func (t *TestModule) AssertStarted(args ...interface{})

AssertStarted waits for the module to start, or does nothing if the module is already streaming.

func (*TestModule) Close Uses

func (t *TestModule) Close()

Close closes the module's channels, allowing the bar to restart the module on click.

func (*TestModule) Output Uses

func (t *TestModule) Output(out bar.Output)

Output queues output to be sent over the channel on the next read.

func (*TestModule) OutputText Uses

func (t *TestModule) OutputText(text string)

OutputText is shorthand for Output(bar.TextSegment(...)).

func (*TestModule) SkipClickHandlers Uses

func (t *TestModule) SkipClickHandlers() *TestModule

SkipClickHandlers configures the module to skip adding a default click handler on output. Setting this will break AssertClicked, but can be useful when comparing the output of this module in tests.

func (*TestModule) Stream Uses

func (t *TestModule) Stream(sink bar.Sink)

Stream conforms to bar.Module.

Package module imports 5 packages (graph). Updated 2019-01-22. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).