//go:build test && dev package payments import ( "os" "testing" "crussell/db" "crussell/internal/square" "crussell/testutils/jwt" "crussell/testutils/testdb" ) func TestMain(m *testing.M) { pool := testdb.CreateTestDatabase("crussell_test_handlers_payments") db.Conn = db.NewPoolProxy(pool) jwt.Init() square.Client = square.NewDevClient() SquareClient = square.Client // Default the package to an explicit dev/mock Square env so generic payment // tests run with the 2FA gate OFF. twoFactorEnforced() is fail-closed: an // empty SQUARE_ENVIRONMENT now means ENFORCED, so a dev default must be set // explicitly. Tests that assert enforcement flip these via t.Setenv. os.Setenv("REQUIRE_2FA", "") os.Setenv("SQUARE_ENVIRONMENT", "mock") testdb.SeedBaseline(pool) code := m.Run() testdb.DestroyTestDatabase(pool, "crussell_test_handlers_payments") os.Exit(code) }