Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ProjectRootFilePath = filepath.Join(filepath.Dir(b), "../..")
)
ProjectRootFilePath is a Golang-native mechanism to get the root of the package structure on the filesystem. With this, tests can introspect files (e.g. database changelogs) without needing to use relative paths themselves (which would be relative to the test file itself). H/T https://stackoverflow.com/a/58294680
Functions ¶
func Cleanup ¶
Cleanup can be run immediately, or deferred with each test run so that we can ensure each case starts with a clean database
func ConnectAndMigrate ¶
ConnectAndMigrate will parse config to attempt to establish a connection to the test database It will cause the test to fail fatally if an error is encountered. It will then attempt to apply all migrations in /db/migrations to that database and will fail similarly if an error is encountered
func SetupTestContext ¶
func SetupTestContext() (*gin.Context, *httptest.ResponseRecorder)
Types ¶
This section is empty.