TinySkin/test/server_test.go
thehrz 145bb045e9
Some checks failed
CI / deploy (push) Failing after 2m53s
fork from xmdhs/authlib-skin
2025-01-24 16:57:58 +08:00

27 lines
495 B
Go

package test
import (
"context"
"os"
"testing"
"github.com/pelletier/go-toml/v2"
"github.com/samber/lo"
"github.com/xmdhs/authlib-skin/config"
"github.com/xmdhs/authlib-skin/server"
)
func TestMain(m *testing.M) {
ctx := context.Background()
b := lo.Must(os.ReadFile("config.toml"))
var config config.Config
lo.Must0(toml.Unmarshal(b, &config))
s, cancel := lo.Must2(server.InitializeRoute(ctx, config))
defer cancel()
go func() {
s.ListenAndServe()
}()
os.Exit(m.Run())
}