Documentation
¶
Index ¶
- func AssertIDSet(t *testing.T, got, expected []string)
- func AssertPaths(t *testing.T, paths []graph.Path, idMap opengraph.IDMap, expected [][]string)
- func ClearGraph(t *testing.T, db graph.Database, ctx context.Context)
- func LoadDataset(t *testing.T, db graph.Database, ctx context.Context, name string) opengraph.IDMap
- func QueryNodeIDs(t *testing.T, ctx context.Context, db graph.Database, cypher string, ...) []string
- func QueryPaths(t *testing.T, ctx context.Context, db graph.Database, cypher string) []graph.Path
- func SetupDB(t *testing.T, datasets ...string) (graph.Database, context.Context)
- func SetupDBWithKinds(t *testing.T, extraNodeKinds, extraEdgeKinds graph.Kinds, datasets ...string) (graph.Database, context.Context)
- func SetupDBWithKindsNoGraphCleanup(t *testing.T, extraNodeKinds, extraEdgeKinds graph.Kinds, datasets ...string) (graph.Database, context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertIDSet ¶
AssertIDSet checks that two sets of fixture node IDs match (order-independent).
func AssertPaths ¶
AssertPaths checks that the returned paths match the expected set of fixture node ID sequences. Each expected path is a slice of fixture node IDs, e.g. []string{"a", "b", "d"}. Pass nil for expected when no paths should be returned.
func ClearGraph ¶
ClearGraph deletes all nodes (and cascading edges) from the database.
func LoadDataset ¶
LoadDataset loads a named JSON dataset from testdata/ and returns the ID mapping.
func QueryNodeIDs ¶
func QueryNodeIDs(t *testing.T, ctx context.Context, db graph.Database, cypher string, idMap opengraph.IDMap) []string
QueryNodeIDs runs a Cypher query that returns nodes and collects their fixture IDs. Duplicate nodes are deduplicated.
func QueryPaths ¶
QueryPaths runs a Cypher query and collects all returned paths.
func SetupDB ¶
SetupDB opens a database connection for the selected driver, asserts a schema derived from the given datasets, and registers cleanup. Returns the database and a background context.
func SetupDBWithKinds ¶ added in v0.5.0
func SetupDBWithKinds(t *testing.T, extraNodeKinds, extraEdgeKinds graph.Kinds, datasets ...string) (graph.Database, context.Context)
SetupDBWithKinds opens a database connection like SetupDB, then extends the asserted schema with additional node and edge kinds.
func SetupDBWithKindsNoGraphCleanup ¶ added in v0.5.0
func SetupDBWithKindsNoGraphCleanup(t *testing.T, extraNodeKinds, extraEdgeKinds graph.Kinds, datasets ...string) (graph.Database, context.Context)
SetupDBWithKindsNoGraphCleanup opens a database connection like SetupDBWithKinds but only closes the connection during cleanup. Use this for rollback-only tests that must not clear a shared database.
Types ¶
This section is empty.