Documentation
¶
Overview ¶
Package helpers provides test helper utilities for integration tests.
Package helpers provides test helper utilities for integration tests.
Index ¶
- func MockAuthServer(t *testing.T) (*httptest.Server, func())
- func MockStrapiServer(t *testing.T) (*httptest.Server, func())
- func MockZeroDBServer(t *testing.T) (*httptest.Server, func())
- func SetupInMemoryDB(t *testing.T) (*database.DB, func())
- func SetupMockServer(t *testing.T, config *MockServerConfig) (*httptest.Server, func())
- func SetupTestDB(t *testing.T) (*database.DB, func())
- type MockServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockAuthServer ¶
MockAuthServer creates a mock OAuth server for authentication testing.
func MockStrapiServer ¶
MockStrapiServer creates a mock Strapi API server for testing.
func MockZeroDBServer ¶
MockZeroDBServer creates a mock ZeroDB API server for testing.
func SetupInMemoryDB ¶
SetupInMemoryDB creates an in-memory SQLite database for testing. This is faster than file-based databases but doesn't persist between runs.
func SetupMockServer ¶
func SetupMockServer(t *testing.T, config *MockServerConfig) (*httptest.Server, func())
SetupMockServer creates a mock HTTP server for testing external API calls.
Types ¶
type MockServerConfig ¶
type MockServerConfig struct {
// Handlers maps request paths to handler functions
Handlers map[string]http.HandlerFunc
// DefaultHandler is used when no specific handler is found
DefaultHandler http.HandlerFunc
}
MockServerConfig holds configuration for the mock HTTP server.
Click to show internal directories.
Click to hide internal directories.