testutil

package
v0.0.0-...-555a7fe Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempProject

func CreateTempProject(t *testing.T) (dir string, cleanup func())

CreateTempProject creates a temporary project structure for testing

func CreateTestDir

func CreateTestDir(t *testing.T, path string)

CreateTestDir creates a test directory

func DirExists

func DirExists(path string) bool

DirExists checks if a directory exists

func FileExists

func FileExists(path string) bool

FileExists checks if a file exists

func NewTestServer

func NewTestServer(t *testing.T, responses map[string]TestResponse) *httptest.Server

NewTestServer creates a test HTTP server with predefined responses

func NewTestServerWithHandler

func NewTestServerWithHandler(handler http.HandlerFunc) *httptest.Server

NewTestServerWithHandler creates a test server with custom handler

func ReadTestFile

func ReadTestFile(t *testing.T, path string) string

ReadTestFile reads content from a test file

func TestArticle

func TestArticle() *api.Article

TestArticle returns a sample article for testing

func TestContentBlock

func TestContentBlock() *api.ContentBlock

TestContentBlock returns a sample content block for testing

func TestProduct

func TestProduct() *api.Product

TestProduct returns a sample product for testing

func TestTheme

func TestTheme() *api.Theme

TestTheme returns a sample theme for testing

func TestThemeMinimal

func TestThemeMinimal() *api.Theme

TestThemeMinimal returns a minimal theme for testing Note: Variables and Assets are explicitly nil (not just omitted)

func WriteTestFile

func WriteTestFile(t *testing.T, path, content string)

WriteTestFile writes content to a test file

Types

type TestResponse

type TestResponse struct {
	StatusCode int
	Body       interface{}
	Headers    map[string]string
}

TestResponse defines a mock HTTP response

Jump to

Keyboard shortcuts

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