testhelpers

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNeo4jAvailable

func IsNeo4jAvailable() bool

IsNeo4jAvailable checks if Neo4j is available for testing

Types

type Neo4jTestContainer

type Neo4jTestContainer struct {
	URI      string
	Username string
	Password string
}

Neo4jTestContainer holds the connection details for docker-compose Neo4j

func SetupNeo4jTest

func SetupNeo4jTest(t *testing.T) (*Neo4jTestContainer, func())

SetupNeo4jTest is a convenience function for setting up Neo4j in tests It ensures Neo4j is running and returns a cleanup function

func StartNeo4jContainer

func StartNeo4jContainer(ctx context.Context) (*Neo4jTestContainer, error)

StartNeo4jContainer ensures Neo4j is running via docker-compose or uses existing service in CI

func (*Neo4jTestContainer) ClearDatabase

func (tc *Neo4jTestContainer) ClearDatabase(ctx context.Context) error

ClearDatabase removes all nodes and relationships from the database

func (*Neo4jTestContainer) ClearDatabaseForProject

func (tc *Neo4jTestContainer) ClearDatabaseForProject(ctx context.Context, projectID string) error

ClearDatabaseForProject removes all nodes and relationships for a specific project

func (*Neo4jTestContainer) CreateDriver

func (tc *Neo4jTestContainer) CreateDriver() (neo4j.DriverWithContext, error)

CreateDriver creates a new Neo4j driver for the test container

func (*Neo4jTestContainer) CreateRepository

func (tc *Neo4jTestContainer) CreateRepository() (*infra.Neo4jRepository, error)

CreateRepository creates a new Neo4j repository using the test container

func (*Neo4jTestContainer) ExecuteCypher

func (tc *Neo4jTestContainer) ExecuteCypher(ctx context.Context, query string, params map[string]any) error

ExecuteCypher executes a Cypher query against the test database

func (*Neo4jTestContainer) Stop

Stop is a no-op since docker-compose keeps running between tests

func (*Neo4jTestContainer) VerifyConnection

func (tc *Neo4jTestContainer) VerifyConnection(ctx context.Context) error

VerifyConnection checks if the Neo4j connection is working

type TestConfig

type TestConfig struct {
	Neo4j struct {
		URI      string
		Username string
		Password string
		Database string
	}
}

TestConfig represents test configuration

func GetTestConfig

func GetTestConfig() *TestConfig

GetTestConfig returns a default test configuration

Jump to

Keyboard shortcuts

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