ddbtest

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PutFixtures

func PutFixtures(t *testing.T, c ddb.Storage, fixtures interface{})

PutFixtures inserts fixture data into the database. It's useful for provisioning data to be used in integration tests.

The provided fixtures may be a single item or a slice of items.

Each provided item must implement the ddb.Keyer interface. The test will fail if you try and insert an item which doesn't implement it.

To insert multiple items:

ddbtest.PutFixtures(t, client, []MyData{{ID: "1"}, {ID: "2"}})

To insert a single item:

ddbtest.PutFixtures(t, client, MyData{ID: "1"})

func RunQueryTests

func RunQueryTests(t *testing.T, c *ddb.Client, testcases []QueryTestCase)

RunQueryTests runs standardised integration tests to check the behaviour of a QueryBuilder.

Types

type QueryTestCase

type QueryTestCase struct {
	Name      string
	Query     ddb.QueryBuilder
	QueryOpts []func(*ddb.QueryOpts)
	Want      ddb.QueryBuilder
	WantErr   error
}

QueryTestCase is a test case for running integration tests which call Query().

Jump to

Keyboard shortcuts

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