integration

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Snapshot testing utilities for integration tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SnapshotFiles

func SnapshotFiles(t *testing.T, testName string, sitePath string, files []string)

SnapshotFiles is a convenience function for common snapshot testing

func SnapshotFilesWithMetadata

func SnapshotFilesWithMetadata(
	t *testing.T,
	testName string,
	sitePath string,
	files []string,
	metadata map[string]any,
)

SnapshotFilesWithMetadata is a convenience function with metadata

Types

type Snapshot

type Snapshot struct {
	Name     string            `json:"name"`
	Files    map[string]string `json:"files"`    // relPath -> content
	Metadata map[string]any    `json:"metadata"` // Additional test metadata
}

Snapshot represents a saved test snapshot

type SnapshotConfig

type SnapshotConfig struct {
	UpdateSnapshots bool // Set to true to update all snapshots (via -update flag)
}

SnapshotConfig controls snapshot behavior

type SnapshotMatcher

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

SnapshotMatcher handles snapshot comparison and updates

func NewSnapshotMatcher

func NewSnapshotMatcher(t *testing.T, testName string) *SnapshotMatcher

NewSnapshotMatcher creates a new snapshot matcher for a test

func (*SnapshotMatcher) MatchSnapshot

func (sm *SnapshotMatcher) MatchSnapshot(sitePath string, filesToCheck []string)

MatchSnapshot compares generated files against saved snapshot

func (*SnapshotMatcher) MatchSnapshotWithMetadata

func (sm *SnapshotMatcher) MatchSnapshotWithMetadata(sitePath string, filesToCheck []string, metadata map[string]any)

MatchSnapshotWithMetadata compares snapshot with additional metadata

Jump to

Keyboard shortcuts

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