module

package
v0.0.0-...-069b4f3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestModule

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

TestModule represents a bar.Module used for testing.

func New

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

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

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

AssertNotClicked asserts that the module received no events.

func (*TestModule) AssertNotStarted

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

AssertNotStarted asserts that the module was not started.

func (*TestModule) AssertStarted

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

func (t *TestModule) Close()

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

func (*TestModule) Output

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

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

func (*TestModule) OutputText

func (t *TestModule) OutputText(text string)

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

func (*TestModule) SkipClickHandlers

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

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

Stream conforms to bar.Module.

Jump to

Keyboard shortcuts

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