//go:build test && dev

package bookings

import (
	"os"
	"testing"

	"crussell/db"
	"crussell/handlers/payments"
	"crussell/internal/square"
	"crussell/testutils/jwt"
	"crussell/testutils/testdb"
)

func TestMain(m *testing.M) {
	pool := testdb.CreateTestDatabase("crussell_test_handlers_bookings")
	db.Conn = db.NewPoolProxy(pool)
	jwt.Init()
	square.Client = square.NewDevClient()
	payments.SquareClient = square.Client
	testdb.SeedBaseline(pool)
	code := m.Run()
	testdb.DestroyTestDatabase(pool, "crussell_test_handlers_bookings")
	os.Exit(code)
}
