helpers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package helpers provides test helper utilities for integration tests.

Package helpers provides test helper utilities for integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockAuthServer

func MockAuthServer(t *testing.T) (*httptest.Server, func())

MockAuthServer creates a mock OAuth server for authentication testing.

func MockStrapiServer

func MockStrapiServer(t *testing.T) (*httptest.Server, func())

MockStrapiServer creates a mock Strapi API server for testing.

func MockZeroDBServer

func MockZeroDBServer(t *testing.T) (*httptest.Server, func())

MockZeroDBServer creates a mock ZeroDB API server for testing.

func SetupInMemoryDB

func SetupInMemoryDB(t *testing.T) (*database.DB, func())

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.

func SetupTestDB

func SetupTestDB(t *testing.T) (*database.DB, func())

SetupTestDB creates a temporary SQLite database for testing. Returns the database instance and a cleanup function.

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.

Jump to

Keyboard shortcuts

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