assertanswer

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package assertanswer provides testing functions to validate a plugin's answer

This package is most useful when used in combination with github.com/alexandre-normand/slackscot/test/assertplugin but can be used alone to test individual slackscot Actions.

Example of a typical usage also using assertplugin:

   func TestPlugin(t *testing.T) {
       assertplugin := assertplugin.New(t, "bot")
       yourPlugin := newPlugin()

       assertplugin.AnswersAndReacts(yourPlugin, &slack.Msg{Text: "are you up?"}, func(t *testing.T, answers []*slackscot.Answer, emojis []string) bool {
	          return assert.Len(t, answers, 1) && assertanswer.HasText(t, answers[0], "I'm 😴, you?")
       }))
   }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasOptions

func HasOptions(t *testing.T, answer *slackscot.Answer, options ...ResolvedAnswerOption) bool

HasOptions asserts that the answer's options contains the expected configuration key/values

func HasText

func HasText(t *testing.T, answer *slackscot.Answer, text string) bool

HasText asserts that the answer's text is the expected text

func HasTextContaining

func HasTextContaining(t *testing.T, answer *slackscot.Answer, subString string) bool

HasTextContaining asserts that the answer's text contains the expected subString

Types

type ResolvedAnswerOption

type ResolvedAnswerOption struct {
	Key   string
	Value string
}

ResolvedAnswerOption holds a pair of Key/Value representing the physical AnswerOption

Jump to

Keyboard shortcuts

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