testutils

package
v0.10.11 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBirthdayNotificationsTable

func CreateBirthdayNotificationsTable(t *testing.T, db *sql.DB)

CreateBirthdayNotificationsTable creates the birthday_notifications table in the test database

func NotMentioned

func NotMentioned(username string, year int, message *telebot.Message) bool

NotMentioned is a test-friendly version of the notMentioned function that handles the sql.ErrNoRows case correctly

func SetupTestDB

func SetupTestDB(t *testing.T) *sql.DB

SetupTestDB creates an in-memory SQLite database for testing

Types

type MockBotWrapper

type MockBotWrapper struct {
	SendCalled        bool
	SendTo            telebot.Recipient
	SendWhat          interface{}
	SendOpts          []interface{}
	ReplyFunc         func(message *telebot.Message, what interface{}, options ...interface{}) (*telebot.Message, error)
	SendFunc          func(to telebot.Recipient, what interface{}, options ...interface{}) (*telebot.Message, error)
	SendPollCalled    bool
	SendPollTo        telebot.Recipient
	SendPollQuestion  string
	SendPollOptions   []string
	SendPollAnonymous bool
	SendPollMultiple  bool
	SendPollFunc      func(to telebot.Recipient, question string, options []string, isAnonymous bool, allowsMultipleAnswers bool) (*telebot.Message, error)
	// Track notification calls
	NotifyCalled bool
	NotifyTo     telebot.Recipient
	NotifyAction telebot.ChatAction
	// Me represents the bot's own user information
	Me *telebot.User
}

MockBotWrapper implements registry.BotInterface for testing

func (*MockBotWrapper) Notify added in v0.2.4

func (m *MockBotWrapper) Notify(to telebot.Recipient, action telebot.ChatAction) error

Notify implements the Notify method for the mock bot

func (*MockBotWrapper) Reply added in v0.2.3

func (m *MockBotWrapper) Reply(message *telebot.Message, what interface{}, options ...interface{}) (*telebot.Message, error)

Reply implements the Reply method for the mock bot

func (*MockBotWrapper) Send

func (m *MockBotWrapper) Send(to telebot.Recipient, what interface{}, options ...interface{}) (*telebot.Message, error)

Send implements the Send method for the mock bot

func (*MockBotWrapper) SendPoll added in v0.8.8

func (m *MockBotWrapper) SendPoll(to telebot.Recipient, question string, options []string, isAnonymous bool, allowsMultipleAnswers bool) (*telebot.Message, error)

Jump to

Keyboard shortcuts

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