testkit

package
v0.2.4-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupServerHub

func CleanupServerHub(t *testing.T, deps *core.ServerDependencies)

CleanupServerHub gracefully shuts down websocket runtime for dependencies.

func CreateTestDeps

func CreateTestDeps(t *testing.T, cfg *config.Config, configFile string) *core.ServerDependencies

CreateTestDeps creates minimal ServerDependencies for testing.

func CurrentHub

func CurrentHub() *ws.Hub

CurrentHub returns the default websocket hub for assertions.

func InitTestWebSocket

func InitTestWebSocket(t *testing.T)

InitTestWebSocket initializes runtime websocket state for tests.

func NewMockActressRepo

func NewMockActressRepo() *database.ActressRepository

NewMockActressRepo creates a test actress repository with in-memory database.

func NewMockMovieRepo

func NewMockMovieRepo() *database.MovieRepository

NewMockMovieRepo creates a test movie repository with in-memory database.

func StartStandaloneHub

func StartStandaloneHub() (*ws.Hub, context.CancelFunc, <-chan struct{})

StartStandaloneHub starts a websocket hub with cancellation for dedicated tests.

Types

type MockScraperWithResults

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

mockScraperWithResults implements Scraper and returns predefined results For security testing, it echoes back the ID in the result to verify sanitization

func NewMockScraperWithResults

func NewMockScraperWithResults(name string, enabled bool, result *models.ScraperResult, err error) *MockScraperWithResults

NewMockScraperWithResults creates a new mock scraper with predefined results

func (*MockScraperWithResults) Close

func (m *MockScraperWithResults) Close() error

func (*MockScraperWithResults) Config

func (*MockScraperWithResults) GetURL

func (m *MockScraperWithResults) GetURL(id string) (string, error)

func (*MockScraperWithResults) IsEnabled

func (m *MockScraperWithResults) IsEnabled() bool

func (*MockScraperWithResults) Name

func (m *MockScraperWithResults) Name() string

func (*MockScraperWithResults) Search

Jump to

Keyboard shortcuts

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