25 lines
506 B
Go
25 lines
506 B
Go
package handlers
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"git.gobha.me/xcaliber/chat-switchboard/database"
|
|
"git.gobha.me/xcaliber/chat-switchboard/providers"
|
|
)
|
|
|
|
// TestMain sets up the test DB (if available) and runs all tests.
|
|
// DB-dependent tests call database.RequireTestDB(t) to skip gracefully
|
|
// when no DB is configured.
|
|
func TestMain(m *testing.M) {
|
|
gin.SetMode(gin.TestMode)
|
|
providers.Init()
|
|
|
|
teardown := database.SetupTestDB()
|
|
code := m.Run()
|
|
teardown()
|
|
os.Exit(code)
|
|
}
|