Package: test
Testing utilities for Go applications in the Dracory ecosystem: tools for setting up test environments, managing test databases, and exercising HTTP endpoints.
Repository: https://github.com/dracory/test
Installation
go get github.com/dracory/test
Usage
func TestHomePage(t *testing.T) {
response := test.NewRequest().Get("/").Response()
if response.StatusCode() != 200 {
t.Fatal("expected 200")
}
}
Features
test.NewRequest()— fluent builder for issuing requests against a handler/router in tests.- Test environment helpers — configure and tear down test databases.
- Used throughout the project's own test suite (
internal/testutilscomplements it with app fixtures).