Changeset 0.7.2 (#40)
This commit is contained in:
24
server/handlers/testmain_test.go
Normal file
24
server/handlers/testmain_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user